Socket
Socket
Sign inDemoInstall

json-dry

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

json-dry - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

26

lib/json-dry.js

@@ -56,7 +56,9 @@ /**

mapp = [specialChar],
isObject = (typeof value === 'object'),
i
;
return function(key, value) {
var valType = typeof value;
var valType;

@@ -69,4 +71,6 @@ // the replacer has rights to decide

valType = typeof value
// did you know ? Safari passes keys as integers for arrays
if (key !== '') {
if (key !== '' || !isObject) {

@@ -91,3 +95,3 @@ if (valType === 'object' && value) {

path.pop();
if (typeof value === 'string') {
if (valType === 'string') {
// ensure no special char involved on deserialization

@@ -98,2 +102,12 @@ // in this case only first char is important

.replace(specialChar, safeSpecialChar);
} else if (valType === 'number') {
// Allow infinite values
if (!isFinite(value)) {
if (value > 0) {
value = {dry: '+Infinity'};
} else {
value = {dry: '-Infinity'};
}
}
}

@@ -125,5 +139,9 @@ }

}
} else if (valType == 'object') {
} else if (value && valType == 'object' && typeof value.dry !== 'undefined') {
if (value.dry == 'regexp' && value.value) {
return RegExp.apply(undefined, getregex.exec(value.value).slice(1));
} else if (value.dry == '+Infinity') {
return Infinity;
} else if (value.dry == '-Infinity') {
return -Infinity;
}

@@ -130,0 +148,0 @@ }

2

package.json
{
"name": "json-dry",
"description": "JSON generator & parser with circular, date and regex support",
"version": "0.1.2",
"version": "0.1.3",
"author": "Jelle De Loecker <jelle@codedor.be>",

@@ -6,0 +6,0 @@ "keywords": ["json", "circular", "serialization", "deserialization"],

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