Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

circular-json

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

circular-json - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

2

build/circular-json.js
/*! (C) WebReflection Mit Style License */
var CircularJSON=function(e,t){function a(e,t,s){var u=[],a=[e],f=[s?n:"[Circular]"],l;return function(e,c){return t&&(c=t(e,c)),e!==""&&(typeof c=="object"&&c?(l=o.call(a,c),l<0?(l=a.push(c)-1,s?(u.push((""+e).replace(i,r)),f[l]=n+u.join(n)):f[l]=f[0]):c=f[l]):(u.pop(),typeof c=="string"&&s&&(c=c.replace(n,r)))),c}}function f(e,t){for(var r=0,i=t.length;r<i;e=e[t[r++].replace(s,n)]);return e}function l(e){return function(t,i){var s=typeof i=="string";return s&&i.charAt(0)===n?new u(i.slice(1)):(t===""&&(i=p(i,i,{})),s&&(i=i.replace(r,n)),e?e(t,i):i)}}function c(e,t,n){for(var r=0,i=t.length;r<i;r++)t[r]=p(e,t[r],n);return t}function h(e,t,n){for(var r in t)t.hasOwnProperty(r)&&(t[r]=p(e,t[r],n));return t}function p(e,t,r){return t instanceof Array?c(e,t,r):t instanceof u?t.length?r.hasOwnProperty(t)?r[t]:r[t]=f(e,t.split(n)):e:t instanceof Object?h(e,t,r):t}function d(t,n,r,i){return e.stringify(t,a(t,n,!i),r)}function v(t,n){return e.parse(t,l(n))}var n="~",r="\\x"+("0"+n.charCodeAt(0).toString(16)).slice(-2),i=new t(r,"g"),s=new t("\\"+r,"g"),o=[].indexOf||function(e){for(var t=this.length;t--&&this[t]!==e;);return t},u=String;return{stringify:d,parse:v}}(JSON,RegExp);
var CircularJSON=function(e,t){function l(e,t,o){var u=[],f=[e],l=[o?n:"[Circular]"],c;return function(e,h){return t&&(h=t(e,h)),e!==""&&(typeof h=="object"&&h?(c=a.call(f,h),c<0?(c=f.push(h)-1,o?(u.push((""+e).replace(s,r)),l[c]=n+u.join(n)):l[c]=l[0]):h=l[c]):(u.pop(),typeof h=="string"&&o&&(h=h.replace(r,i).replace(n,r)))),h}}function c(e,t){for(var r=0,i=t.length;r<i;e=e[t[r++].replace(o,n)]);return e}function h(e){return function(t,s){var o=typeof s=="string";return o&&s.charAt(0)===n?new f(s.slice(1)):(t===""&&(s=v(s,s,{})),o&&(s=s.replace(u,n).replace(i,r)),e?e(t,s):s)}}function p(e,t,n){for(var r=0,i=t.length;r<i;r++)t[r]=v(e,t[r],n);return t}function d(e,t,n){for(var r in t)t.hasOwnProperty(r)&&(t[r]=v(e,t[r],n));return t}function v(e,t,r){return t instanceof Array?p(e,t,r):t instanceof f?t.length?r.hasOwnProperty(t)?r[t]:r[t]=c(e,t.split(n)):e:t instanceof Object?d(e,t,r):t}function m(t,n,r,i){return e.stringify(t,l(t,n,!i),r)}function g(t,n){return e.parse(t,h(n))}var n="~",r="\\x"+("0"+n.charCodeAt(0).toString(16)).slice(-2),i="\\"+r,s=new t(r,"g"),o=new t(i,"g"),u=new t("(?:^|[^\\\\])"+i),a=[].indexOf||function(e){for(var t=this.length;t--&&this[t]!==e;);return t},f=String;return{stringify:m,parse:g}}(JSON,RegExp);

@@ -33,4 +33,8 @@ /*!

).slice(-2),
escapedSafeSpecialChar = '\\' + safeSpecialChar,
specialCharRG = new RegExp(safeSpecialChar, 'g'),
safeSpecialCharRG = new RegExp('\\' + safeSpecialChar, 'g'),
safeSpecialCharRG = new RegExp(escapedSafeSpecialChar, 'g'),
safeStartWithSpecialCharRG = new RegExp('(?:^|[^\\\\])' + escapedSafeSpecialChar),
indexOf = [].indexOf || function(v){

@@ -81,3 +85,4 @@ for(var i=this.length;i--&&this[i]!==v;);

// no need to replace all value (better performance)
value = value.replace(specialChar, safeSpecialChar);
value = value .replace(safeSpecialChar, escapedSafeSpecialChar)
.replace(specialChar, safeSpecialChar);
}

@@ -107,3 +112,4 @@ }

// only keys need the RegExp
if (isString) value = value.replace(safeSpecialChar, specialChar);
if (isString) value = value .replace(safeStartWithSpecialCharRG, specialChar)
.replace(escapedSafeSpecialChar, safeSpecialChar);
return reviver ? reviver(key, value) : value;

@@ -110,0 +116,0 @@ };

@@ -32,4 +32,8 @@ /*!

).slice(-2),
escapedSafeSpecialChar = '\\' + safeSpecialChar,
specialCharRG = new RegExp(safeSpecialChar, 'g'),
safeSpecialCharRG = new RegExp('\\' + safeSpecialChar, 'g'),
safeSpecialCharRG = new RegExp(escapedSafeSpecialChar, 'g'),
safeStartWithSpecialCharRG = new RegExp('(?:^|[^\\\\])' + escapedSafeSpecialChar),
indexOf = [].indexOf || function(v){

@@ -80,3 +84,4 @@ for(var i=this.length;i--&&this[i]!==v;);

// no need to replace all value (better performance)
value = value.replace(specialChar, safeSpecialChar);
value = value .replace(safeSpecialChar, escapedSafeSpecialChar)
.replace(specialChar, safeSpecialChar);
}

@@ -106,3 +111,4 @@ }

// only keys need the RegExp
if (isString) value = value.replace(safeSpecialChar, specialChar);
if (isString) value = value .replace(safeStartWithSpecialCharRG, specialChar)
.replace(escapedSafeSpecialChar, safeSpecialChar);
return reviver ? reviver(key, value) : value;

@@ -109,0 +115,0 @@ };

{
"version": "0.1.2",
"version": "0.1.3",
"name": "circular-json",

@@ -4,0 +4,0 @@ "description": "JSON does not handle circular references. This version does",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc