fast-json-stringify
Advanced tools
Comparing version 0.1.1 to 0.2.0
15
index.js
@@ -11,2 +11,3 @@ 'use strict' | ||
${$asNull.toString()} | ||
${$asBoolean.toString()} | ||
` | ||
@@ -27,2 +28,5 @@ var main | ||
break | ||
case 'boolean': | ||
main = $asBoolean.name | ||
break | ||
case 'null': | ||
@@ -49,3 +53,3 @@ main = $asNull.name | ||
function $asNull (i) { | ||
function $asNull () { | ||
return 'null' | ||
@@ -63,2 +67,6 @@ } | ||
function $asBoolean (bool) { | ||
return bool && 'true' || 'false' | ||
} | ||
function $asString (str) { | ||
@@ -175,2 +183,7 @@ if (str instanceof Date) { | ||
break | ||
case 'boolean': | ||
code += ` | ||
json += $asBoolean(obj${key}) | ||
` | ||
break | ||
case 'object': | ||
@@ -177,0 +190,0 @@ funcName = (name + key).replace(/[-.\[\]]/g, '') |
{ | ||
"name": "fast-json-stringify", | ||
"version": "0.1.1", | ||
"version": "0.2.0", | ||
"description": "Stringify your JSON at max speed", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
22
test.js
@@ -54,2 +54,12 @@ 'use strict' | ||
buildTest({ | ||
title: 'boolean true', | ||
type: 'boolean' | ||
}, true) | ||
buildTest({ | ||
title: 'boolean false', | ||
type: 'boolean' | ||
}, false) | ||
buildTest({ | ||
title: 'an integer', | ||
@@ -199,1 +209,13 @@ type: 'integer' | ||
}) | ||
buildTest({ | ||
'title': 'object with boolean', | ||
'type': 'object', | ||
'properties': { | ||
'readonly': { | ||
'type': 'boolean' | ||
} | ||
} | ||
}, { | ||
readonly: true | ||
}) |
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
12771
481