Skip to content

Commit e9bbb04

Browse files
bryanmikaelianhbrls
authored andcommitted
Replace @ndhoule/pick with lodash.pick (segmentio#210)
1 parent 7e87432 commit e9bbb04

File tree

4 files changed

+15
-9
lines changed

4 files changed

+15
-9
lines changed

HISTORY.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010

1111
- Fix Potential DOM-based XSS via prototype pollution
1212

13+
# 4.1.3 / 2020-09-16
14+
15+
- Replace `@ndhoule/pick` with `lodash.pick`
16+
1317
# 4.1.2 / 2020-09-16
1418

1519
- Replaces `@ndhoule/extend` with `lodash.assignin`

lib/analytics.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import {
88
SegmentIntegration
99
} from './types';
1010

11+
import pick from 'lodash.pick'
12+
1113
var _analytics = global.analytics;
1214

1315
/*
@@ -42,7 +44,6 @@ var nextTick = require('next-tick');
4244
var normalize = require('./normalize');
4345
var on = require('component-event').bind;
4446
var pageDefaults = require('./pageDefaults');
45-
var pick = require('@ndhoule/pick');
4647
var prevent = require('@segment/prevent-default');
4748
var url = require('component-url');
4849
var store = require('./store');
@@ -600,20 +601,20 @@ Analytics.prototype.page = function(
600601

601602
// Ensure properties has baseline spec properties.
602603
// TODO: Eventually move these entirely to `options.context.page`
603-
var defs = pageDefaults();
604+
const defs = pageDefaults();
604605
defaults(properties, defs);
605606

606607
// Mirror user overrides to `options.context.page` (but exclude custom properties)
607608
// (Any page defaults get applied in `this.normalize` for consistency.)
608609
// Weird, yeah--moving special props to `context.page` will fix this in the long term.
609-
var overrides = pick(Object.keys(defs), properties);
610+
const overrides = pick(properties, Object.keys(defs));
610611
if (!is.empty(overrides)) {
611612
options = options || {};
612613
options.context = options.context || {};
613614
options.context.page = overrides;
614615
}
615616

616-
var msg = this.normalize({
617+
const msg = this.normalize({
617618
properties: properties,
618619
category: category,
619620
options: options,

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
"dependencies": {
3333
"@ndhoule/defaults": "^2.0.1",
3434
"@ndhoule/includes": "^2.0.1",
35-
"@ndhoule/pick": "^2.0.0",
3635
"@segment/canonical": "^1.0.0",
3736
"@segment/cookie": "^1.1.5",
3837
"@segment/is-meta": "^1.0.0",
@@ -54,6 +53,7 @@
5453
"is": "^3.1.0",
5554
"lodash.assignin": "^4.2.0",
5655
"lodash.clonedeep": "^4.5.0",
56+
"lodash.pick": "^4.4.0",
5757
"new-date": "^1.0.0",
5858
"next-tick": "^0.2.2",
5959
"package-json-versionify": "^1.0.4",

yarn.lock

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -315,10 +315,6 @@
315315
dependencies:
316316
"@ndhoule/each" "^2.0.1"
317317

318-
"@ndhoule/pick@^2.0.0":
319-
version "2.0.0"
320-
resolved "https://registry.yarnpkg.com/@ndhoule/pick/-/pick-2.0.0.tgz#e1eb1a6ca3243eef56daa095c3a1612c74a52156"
321-
322318
"@ndhoule/rest@^2.0.0":
323319
version "2.0.0"
324320
resolved "https://registry.yarnpkg.com/@ndhoule/rest/-/rest-2.0.0.tgz#0346b02a964a513ed2ba24d164f01d34f2107a0f"
@@ -6102,6 +6098,11 @@ lodash.mergewith@^4.6.2:
61026098
resolved "https://registry.yarnpkg.com/lodash.mergewith/-/lodash.mergewith-4.6.2.tgz#617121f89ac55f59047c7aec1ccd6654c6590f55"
61036099
integrity sha512-GK3g5RPZWTRSeLSpgP8Xhra+pnjBC56q9FZYe1d5RN3TJ35dbkGy3YqBSMbyCrlbi+CM9Z3Jk5yTL7RCsqboyQ==
61046100

6101+
lodash.pick@^4.4.0:
6102+
version "4.4.0"
6103+
resolved "https://registry.yarnpkg.com/lodash.pick/-/lodash.pick-4.4.0.tgz#52f05610fff9ded422611441ed1fc123a03001b3"
6104+
integrity sha1-UvBWEP/53tQiYRRB7R/BI6AwAbM=
6105+
61056106
lodash.reduce@^4.6.0:
61066107
version "4.6.0"
61076108
resolved "https://registry.yarnpkg.com/lodash.reduce/-/lodash.reduce-4.6.0.tgz#f1ab6b839299ad48f784abbf476596f03b914d3b"

0 commit comments

Comments
 (0)