@@ -9,7 +9,6 @@ var clone = require('component-clone');
99var cookie = require ( 'component-cookie' ) ;
1010var extend = require ( '@ndhoule/extend' ) ;
1111var integration = require ( '@segment/analytics.js-integration' ) ;
12- var json = require ( 'json3' ) ;
1312var keys = require ( '@ndhoule/keys' ) ;
1413var localstorage = require ( 'yields-store' ) ;
1514var protocol = require ( '@segment/protocol' ) ;
@@ -118,7 +117,7 @@ exports.sendJsonWithTimeout = function(url, obj, headers, timeout, fn) {
118117 for ( var k in headers ) {
119118 req . setRequestHeader ( k , headers [ k ] ) ;
120119 }
121- req . send ( json . stringify ( obj ) ) ;
120+ req . send ( JSON . stringify ( obj ) ) ;
122121
123122 function done ( ) {
124123 if ( req . readyState === 4 ) {
@@ -352,7 +351,7 @@ Segment.prototype.enqueue = function(path, message, fn) {
352351
353352 // Print a log statement when messages exceed the maximum size. In the future,
354353 // we may consider dropping this event on the client entirely.
355- if ( json . stringify ( msg ) . length > MAX_SIZE ) {
354+ if ( JSON . stringify ( msg ) . length > MAX_SIZE ) {
356355 this . debug ( 'message must be less than 32kb %O' , msg ) ;
357356 }
358357
@@ -416,14 +415,14 @@ Segment.prototype.referrerId = function(query, ctx) {
416415 var stored = this . cookie ( 's:context.referrer' ) ;
417416 var ad ;
418417
419- if ( stored ) stored = json . parse ( stored ) ;
418+ if ( stored ) stored = JSON . parse ( stored ) ;
420419 if ( query ) ad = ads ( query ) ;
421420
422421 ad = ad || stored ;
423422
424423 if ( ! ad ) return ;
425424 ctx . referrer = extend ( ctx . referrer || { } , ad ) ;
426- this . cookie ( 's:context.referrer' , json . stringify ( ad ) ) ;
425+ this . cookie ( 's:context.referrer' , JSON . stringify ( ad ) ) ;
427426} ;
428427
429428/**
@@ -679,7 +678,7 @@ function getJson(url, callback) {
679678 xhr . onreadystatechange = function ( ) {
680679 if ( xhr . readyState === XMLHttpRequest . DONE ) {
681680 if ( xhr . status >= 200 && xhr . status < 300 ) {
682- callback ( null , xhr . responseText ? json . parse ( xhr . responseText ) : null ) ;
681+ callback ( null , xhr . responseText ? JSON . parse ( xhr . responseText ) : null ) ;
683682 } else {
684683 callback ( xhr . statusText || 'Unknown Error' , null ) ;
685684 }
0 commit comments