serialize-javascript
Advanced tools
Comparing version 2.1.2 to 3.0.0
13
index.js
@@ -11,3 +11,3 @@ /* | ||
var UID = Math.floor(Math.random() * 0x10000000000).toString(16); | ||
var PLACE_HOLDER_REGEXP = new RegExp('"@__(F|R|D|M|S|U)-' + UID + '-(\\d+)__@"', 'g'); | ||
var PLACE_HOLDER_REGEXP = new RegExp('"@__(F|R|D|M|S|U|I)-' + UID + '-(\\d+)__@"', 'g'); | ||
@@ -61,2 +61,3 @@ var IS_NATIVE_CODE_REGEXP = /\{\s*\[native code\]\s*\}/g; | ||
var undefs = []; | ||
var infinities= []; | ||
@@ -107,2 +108,6 @@ // Returns placeholders for functions and regexps (identified by index) | ||
if (type === 'number' && !isNaN(origValue) && !isFinite(origValue)) { | ||
return '@__I-' + UID + '-' + (infinities.push(origValue) - 1) + '__@'; | ||
} | ||
return value; | ||
@@ -181,3 +186,3 @@ } | ||
if (functions.length === 0 && regexps.length === 0 && dates.length === 0 && maps.length === 0 && sets.length === 0 && undefs.length === 0) { | ||
if (functions.length === 0 && regexps.length === 0 && dates.length === 0 && maps.length === 0 && sets.length === 0 && undefs.length === 0 && infinities.length === 0) { | ||
return str; | ||
@@ -210,2 +215,6 @@ } | ||
if (type === 'I') { | ||
return infinities[valueIndex]; | ||
} | ||
var fn = functions[valueIndex]; | ||
@@ -212,0 +221,0 @@ |
{ | ||
"name": "serialize-javascript", | ||
"version": "2.1.2", | ||
"version": "3.0.0", | ||
"description": "Serialize JavaScript to a superset of JSON that includes regular expressions and functions.", | ||
@@ -30,5 +30,5 @@ "main": "index.js", | ||
"chai": "^4.1.0", | ||
"mocha": "^6.2.0", | ||
"nyc": "^14.1.1" | ||
"mocha": "^7.0.0", | ||
"nyc": "^15.0.0" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15281
5
186