Skip to content
This repository was archived by the owner on Sep 3, 2022. It is now read-only.

Commit 3b71b10

Browse files
author
Bryan Mikaelian
committed
Remove unusued modules and lib/utils
1 parent 7490ebf commit 3b71b10

File tree

5 files changed

+7
-342
lines changed

5 files changed

+7
-342
lines changed

lib/analytics.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,9 @@ var cookie = require('./cookie');
3434
var metrics = require('./metrics');
3535
var debug = require('debug');
3636
var defaults = require('@ndhoule/defaults');
37-
var each = require('./utils/each');
38-
var foldl = require('@ndhoule/foldl');
3937
var group = require('./group');
4038
var is = require('is');
4139
var isMeta = require('@segment/is-meta');
42-
var keys = require('@ndhoule/keys');
4340
var memory = require('./memory');
4441
var nextTick = require('next-tick');
4542
var normalize = require('./normalize');
@@ -207,7 +204,7 @@ Analytics.prototype.init = Analytics.prototype.initialize = function(
207204

208205
// make ready callback
209206
var readyCallCount = 0;
210-
var integrationCount = keys(integrations).length;
207+
var integrationCount = Object.keys(integrations).length;
211208
var ready = function() {
212209
readyCallCount++;
213210
if (readyCallCount >= integrationCount) {
@@ -609,7 +606,7 @@ Analytics.prototype.page = function(
609606
// Mirror user overrides to `options.context.page` (but exclude custom properties)
610607
// (Any page defaults get applied in `this.normalize` for consistency.)
611608
// Weird, yeah--moving special props to `context.page` will fix this in the long term.
612-
var overrides = pick(keys(defs), properties);
609+
var overrides = pick(Object.keys(defs), properties);
613610
if (!is.empty(overrides)) {
614611
options = options || {};
615612
options.context = options.context || {};
@@ -973,7 +970,7 @@ Analytics.prototype.normalize = function(msg: {
973970
context: { page };
974971
anonymousId: string;
975972
}): object {
976-
msg = normalize(msg, keys(this._integrations));
973+
msg = normalize(msg, Object.keys(this._integrations));
977974
if (msg.anonymousId) user.anonymousId(msg.anonymousId);
978975
msg.anonymousId = user.anonymousId();
979976

lib/utils/each.js

Lines changed: 0 additions & 163 deletions
This file was deleted.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
"@ndhoule/defaults": "^2.0.1",
3434
"@ndhoule/extend": "^2.0.0",
3535
"@ndhoule/includes": "^2.0.1",
36-
"@ndhoule/keys": "^2.0.0",
3736
"@ndhoule/pick": "^2.0.0",
3837
"@segment/canonical": "^1.0.0",
3938
"@segment/cookie": "^1.1.5",

test/analytics.test.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,10 @@ var bind = require('component-event').bind;
88
var createIntegration = require('@segment/analytics.js-integration');
99
var extend = require('@ndhoule/extend');
1010
var type = require('component-type');
11-
// @ts-ignore
12-
var jQuery = require('jquery');
1311
var pageDefaults = require('../build/pageDefaults');
1412
var sinon = require('sinon');
1513
var tick = require('next-tick');
1614
var trigger = require('compat-trigger-event');
17-
1815
var Identify = Facade.Identify;
1916
var cookie = Analytics.cookie;
2017
var group = analytics.group();
@@ -1642,12 +1639,14 @@ describe('Analytics', function() {
16421639
link = document.createElement('a');
16431640
link.href = '#';
16441641
document.body.appendChild(link);
1642+
(window as any).jQuery = require('jquery')
16451643
});
16461644

16471645
afterEach(function() {
16481646
window.location.hash = '';
16491647
if (wrap) document.body.removeChild(wrap);
16501648
document.body.removeChild(link);
1649+
(window as any).jQuery = null
16511650
});
16521651

16531652
it('should trigger a track on an element click', function() {
@@ -1760,11 +1759,11 @@ describe('Analytics', function() {
17601759
var submit;
17611760

17621761
before(function() {
1763-
window.jQuery = jQuery;
1762+
(window as any).jQuery = require('jquery')
17641763
});
17651764

17661765
after(function() {
1767-
window.jQuery = null;
1766+
(window as any).jQuery = null;
17681767
});
17691768

17701769
beforeEach(function() {

0 commit comments

Comments
 (0)