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

javascript-stringify

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

javascript-stringify - npm Package Compare versions

Comparing version 1.3.0 to 1.4.0

11

javascript-stringify.js

@@ -256,2 +256,3 @@ (function (root, stringify) {

var references = !!options.references;
var valueCount = Number(options.maxValues) || 100000;

@@ -288,7 +289,7 @@ var path = [];

if (value && (typeof value === 'object' || typeof value === 'function')) {
var exists = encountered.indexOf(value);
var seen = encountered.indexOf(value);
// Track nodes to restore later.
if (exists > -1) {
restore.push(path.slice(), paths[exists]);
if (seen > -1) {
restore.push(path.slice(), paths[seen]);
return;

@@ -303,3 +304,3 @@ }

// Stop when we hit the max depth.
if (path.length > maxDepth) {
if (path.length > maxDepth || valueCount-- <= 0) {
return;

@@ -314,3 +315,3 @@ }

if (seen > -1 || path.length > maxDepth) {
if (seen > -1 || path.length > maxDepth || valueCount-- <= 0) {
return;

@@ -317,0 +318,0 @@ }

{
"name": "javascript-stringify",
"version": "1.3.0",
"version": "1.4.0",
"description": "Stringify is to `eval` as `JSON.stringify` is to `JSON.parse`",

@@ -5,0 +5,0 @@ "main": "javascript-stringify.js",

@@ -47,4 +47,5 @@ # JavaScript Stringify

* **maxDepth** _(number)_ The maximum depth of values to stringify
* **references** _(boolean)_ Restore circular/repeated references in the object (uses IIFE)
* **maxDepth** _(number, default: 100)_ The maximum depth of values to stringify
* **maxValues** _(number, default: 100000)_ The maximum number of values to stringify
* **references** _(boolean, default: false)_ Restore circular/repeated references in the object (uses IIFE)

@@ -83,2 +84,3 @@ ### Examples

javascriptStringify(obj); // "{x:10}"
javascriptStringify(obj, null, null, { references: true }); // "(function(){var x={x:10};x.circular=x;return x;}())"

@@ -85,0 +87,0 @@ /**

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