Skip to content

Commit 8c9354e

Browse files
author
Julio Farah
authored
Remove ndhoule/defaults in favor of native spread operator (#27)
* chartbeat * google-analytics * gtag * intercom * parsely * simplereach * trackjs * twitter-ads * fix google analytics tests * skip simplereach tests that fail on the original repo
1 parent 736c152 commit 8c9354e

File tree

17 files changed

+57
-40
lines changed

17 files changed

+57
-40
lines changed

integrations/chartbeat/lib/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
* Module dependencies.
55
*/
66

7-
var defaults = require('@ndhoule/defaults');
87
var integration = require('@segment/analytics.js-integration');
98
var onBody = require('on-body');
109

@@ -106,10 +105,11 @@ Chartbeat.prototype._initialize = function() {
106105
var script = this.options.video ? 'chartbeat_video.js' : 'chartbeat.js';
107106

108107
window._sf_async_config.useCanonical = true;
109-
defaults(window._sf_async_config, {
108+
window._sf_async_config = {
109+
...window._sf_async_config,
110110
domain: this.options.domain,
111111
uid: this.options.uid
112-
});
112+
}
113113

114114
onBody(function() {
115115
window._sf_endpt = new Date().getTime();

integrations/chartbeat/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@segment/analytics.js-integration-chartbeat",
33
"description": "The Chartbeat analytics.js integration.",
4-
"version": "2.2.2",
4+
"version": "2.2.3",
55
"keywords": [
66
"analytics.js",
77
"analytics.js-integration",
@@ -24,7 +24,6 @@
2424
"url": "git+https://github.com/segmentio/analytics.js-integrations.git"
2525
},
2626
"dependencies": {
27-
"@ndhoule/defaults": "^2.0.1",
2827
"@segment/analytics.js-integration": "^3.3.2",
2928
"on-body": "0.0.1"
3029
},

integrations/google-analytics/lib/index.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
*/
66

77
var Track = require('segmentio-facade').Track;
8-
var defaults = require('@ndhoule/defaults');
98
var dot = require('obj-case');
109
var each = require('component-each');
1110
var integration = require('@segment/analytics.js-integration');
@@ -302,8 +301,17 @@ GA.prototype.identify = function(identify) {
302301
GA.prototype.track = function(track, options) {
303302
var contextOpts = track.options(this.name);
304303
var interfaceOpts = this.options;
305-
var opts = defaults(options || {}, contextOpts);
306-
opts = defaults(opts, interfaceOpts);
304+
305+
var opts = options ? {
306+
...contextOpts,
307+
...options
308+
} : contextOpts
309+
310+
opts = {
311+
...interfaceOpts,
312+
...opts
313+
}
314+
307315
var props = track.properties();
308316
var campaign = track.proxy('context.campaign') || {};
309317
var self = this;

integrations/google-analytics/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@segment/analytics.js-integration-google-analytics",
33
"description": "The Google Analytics analytics.js integration.",
4-
"version": "2.18.3",
4+
"version": "2.18.4",
55
"keywords": [
66
"analytics.js",
77
"analytics.js-integration",
@@ -24,7 +24,6 @@
2424
"url": "git+https://github.com/segmentio/analytics.js-integrations.git"
2525
},
2626
"dependencies": {
27-
"@ndhoule/defaults": "^2.0.1",
2827
"@segment/analytics.js-integration": "^3.3.2",
2928
"component-each": "^0.2.6",
3029
"extend": "^3.0.1",

integrations/gtag/lib/index.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
var integration = require('@segment/analytics.js-integration');
88
var Track = require('segmentio-facade').Track;
99
var reject = require('reject');
10-
var defaults = require('@ndhoule/defaults');
1110
var extend = require('extend');
1211

1312
/**
@@ -256,7 +255,11 @@ GTAG.prototype.track = function(track, params) {
256255
return;
257256
}
258257
var contextOpts = track.options(this.name);
259-
var opts = defaults(params || {}, contextOpts);
258+
var opts = params ? {
259+
...contextOpts,
260+
...params
261+
} : contextOpts
262+
260263
var props = track.properties();
261264
props.event = event;
262265

integrations/gtag/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@segment/analytics.js-integration-gtag",
33
"description": "The Gtag analytics.js integration.",
4-
"version": "1.0.0-beta.1",
4+
"version": "1.0.0-beta.2",
55
"keywords": [
66
"analytics.js",
77
"analytics.js-integration",

integrations/intercom/lib/index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
*/
66

77
var convertDates = require('@segment/convert-dates');
8-
var defaults = require('@ndhoule/defaults');
98
var del = require('obj-case').del;
109
var integration = require('@segment/analytics.js-integration');
1110
var is = require('is');
@@ -96,7 +95,10 @@ Intercom.prototype.identify = function(identify) {
9695
}
9796

9897
if (traits.company) {
99-
defaults(traits.company, group.traits());
98+
traits.company = {
99+
...group.traits(),
100+
...traits.company
101+
}
100102
}
101103

102104
// name

integrations/intercom/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@segment/analytics.js-integration-intercom",
33
"description": "The Intercom analytics.js integration.",
4-
"version": "3.0.2",
4+
"version": "3.0.3",
55
"keywords": [
66
"analytics.js",
77
"analytics.js-integration",
@@ -25,7 +25,6 @@
2525
},
2626
"dependencies": {
2727
"@ndhoule/clone": "^1.0.0",
28-
"@ndhoule/defaults": "^2.0.1",
2928
"@ndhoule/extend": "^2.0.0",
3029
"@ndhoule/foldl": "^2.0.1",
3130
"@ndhoule/pick": "^2.0.0",

integrations/parsely/lib/index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ var integration = require('@segment/analytics.js-integration');
88
var when = require('do-when');
99
var reject = require('reject');
1010
var is = require('is');
11-
var defaults = require('@ndhoule/defaults');
1211

1312
/**
1413
* Expose `Parsely` integration.
@@ -138,7 +137,10 @@ Parsely.prototype.videoPlaybackPaused = function(track) {
138137
var urlOverride = track.proxy('context.page.url');
139138
var metadata = this.parseVideoMetadata(track);
140139

141-
metadata = defaults(metadata, CURRENT_VIDEO_METADATA);
140+
metadata = {
141+
...CURRENT_VIDEO_METADATA,
142+
...metadata
143+
}
142144

143145
window.PARSELY.video.trackPause(vidId, metadata, urlOverride);
144146
}

integrations/parsely/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@segment/analytics.js-integration-parsely",
33
"description": "The Parsely analytics.js integration.",
4-
"version": "2.3.3",
4+
"version": "2.3.4",
55
"keywords": [
66
"analytics.js",
77
"analytics.js-integration",
@@ -24,7 +24,6 @@
2424
"url": "git+https://github.com/segmentio/analytics.js-integrations.git"
2525
},
2626
"dependencies": {
27-
"@ndhoule/defaults": "^2.0.1",
2827
"@segment/analytics.js-integration": "^3.3.2",
2928
"array-filter": "^1.0.0",
3029
"do-when": "^1.0.0",

0 commit comments

Comments
 (0)