Skip to content
This repository was archived by the owner on Sep 3, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 4.0.2 / 2020-09-01

- Replace @ndhoule/foldl with Array.prototype.reduce

# 4.0.1 / 2020-08-21

- Minor version bump since previous version was published incorrectly. No code change.
Expand Down
18 changes: 7 additions & 11 deletions lib/analytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -939,17 +939,13 @@ Analytics.prototype._parseQuery = function(query: string): SegmentAnalytics {
function pickPrefix(prefix: string, object: object) {
var length = prefix.length;
var sub;
return foldl(
function(acc, val, key) {
if (key.substr(0, length) === prefix) {
sub = key.substr(length);
acc[sub] = val;
}
return acc;
},
{},
object
);
return Object.keys(object).reduce(function(acc, key) {
if (key.substr(0, length) === prefix) {
sub = key.substr(length);
acc[sub] = object[key];
}
return acc;
}, {});
}
};

Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
"dependencies": {
"@ndhoule/defaults": "^2.0.1",
"@ndhoule/extend": "^2.0.0",
"@ndhoule/foldl": "^2.0.1",
"@ndhoule/includes": "^2.0.1",
"@ndhoule/keys": "^2.0.0",
"@ndhoule/pick": "^2.0.0",
Expand Down