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

Commit bf06f41

Browse files
author
King Long Tse
authored
Merge pull request #132 from segmentio/dk1027/lib-1595
LIB-1591: Removed unnecessary packages
2 parents fcbadef + 5520112 commit bf06f41

File tree

4 files changed

+11
-13
lines changed

4 files changed

+11
-13
lines changed

lib/cookie.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ var clone = require('@ndhoule/clone');
99
var cookie = require('@segment/cookie');
1010
var debug = require('debug')('analytics.js:cookie');
1111
var defaults = require('@ndhoule/defaults');
12-
var json = require('json3');
1312
var topDomain = require('@segment/top-domain');
1413

1514
/**
@@ -73,7 +72,7 @@ Cookie.prototype.options = function(options) {
7372

7473
Cookie.prototype.set = function(key, value) {
7574
try {
76-
value = json.stringify(value);
75+
value = window.JSON.stringify(value);
7776
cookie(key, value, clone(this._options));
7877
return true;
7978
} catch (e) {
@@ -91,7 +90,7 @@ Cookie.prototype.set = function(key, value) {
9190
Cookie.prototype.get = function(key) {
9291
try {
9392
var value = cookie(key);
94-
value = value ? json.parse(value) : null;
93+
value = value ? window.JSON.parse(value) : null;
9594
return value;
9695
} catch (e) {
9796
return null;

lib/normalize.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ var each = require('@ndhoule/each');
1010
var includes = require('@ndhoule/includes');
1111
var map = require('@ndhoule/map');
1212
var type = require('component-type');
13-
var uuid = require('uuid').v4;
14-
var json = require('json3');
13+
var uuid = require('uuid/v4');
1514
var md5 = require('spark-md5').hash;
1615

1716
/**
@@ -79,7 +78,7 @@ function normalize(msg, list) {
7978
}, opts);
8079

8180
// generate and attach a messageId to msg
82-
msg.messageId = 'ajs-' + md5(json.stringify(msg) + uuid());
81+
msg.messageId = 'ajs-' + md5(window.JSON.stringify(msg) + uuid());
8382

8483
// cleanup
8584
delete msg.options;

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@segment/analytics.js-core",
33
"author": "Segment <friends@segment.com>",
4-
"version": "3.11.0",
4+
"version": "3.11.1",
55
"description": "The hassle-free way to integrate analytics into any web application.",
66
"keywords": [
77
"analytics",
@@ -58,12 +58,11 @@
5858
"inherits": "^2.0.1",
5959
"install": "^0.7.3",
6060
"is": "^3.1.0",
61-
"json3": "^3.3.2",
6261
"new-date": "^1.0.0",
6362
"next-tick": "^0.2.2",
6463
"segmentio-facade": "^3.0.2",
6564
"spark-md5": "^2.0.2",
66-
"uuid": "^2.0.2"
65+
"uuid": "^3.4.0"
6766
},
6867
"devDependencies": {
6968
"@commitlint/cli": "^7.0.0",

yarn.lock

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7053,14 +7053,15 @@ utils-merge@1.0.1:
70537053
version "1.0.1"
70547054
resolved "https://registry.yarnpkg.com/utils-merge/-/utils-merge-1.0.1.tgz#9f95710f50a267947b2ccc124741c1028427e713"
70557055

7056-
uuid@^2.0.2:
7057-
version "2.0.3"
7058-
resolved "https://registry.yarnpkg.com/uuid/-/uuid-2.0.3.tgz#67e2e863797215530dff318e5bf9dcebfd47b21a"
7059-
70607056
uuid@^3.0.1, uuid@^3.1.0, uuid@^3.2.1:
70617057
version "3.3.2"
70627058
resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.3.2.tgz#1b4af4955eb3077c501c23872fc6513811587131"
70637059

7060+
uuid@^3.4.0:
7061+
version "3.4.0"
7062+
resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee"
7063+
integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==
7064+
70647065
validate-npm-package-license@^3.0.1:
70657066
version "3.0.3"
70667067
resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.3.tgz#81643bcbef1bdfecd4623793dc4648948ba98338"

0 commit comments

Comments
 (0)