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

relaxed-json

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

relaxed-json - npm Package Compare versions

Comparing version 0.2.2 to 0.2.3

2

package.json
{
"name": "relaxed-json",
"description": "Relaxed JSON is strict superset JSON, relaxing strictness of valilla JSON",
"version": "0.2.2",
"version": "0.2.3",
"homepage": "https://github.com/phadej/relaxed-json",

@@ -6,0 +6,0 @@ "author": {

@@ -39,2 +39,5 @@ # Relaxed JSON

- 0.2.3 Bugfixes
- `$` is valid identifier character
- single line comments may end with `CR` and `CRLF` also
- 0.2.2 Bugfix

@@ -41,0 +44,0 @@ - 0.2.1 Code reogranization

@@ -176,5 +176,5 @@ /*

{ re: /^'(([^'\\]|\\['bnrtf\\]|\\u[0-9a-fA-F]{4})*)'/, f: fStringSingle },
{ re: /^\/\/.*?\n/, f: fComment },
{ re: /^\/\/.*?(?:\r\n|\r|\n)/, f: fComment },
{ re: /^\/\*[\s\S]*?\*\//, f: fComment },
{ re: /^[a-zA-Z0-9_\-+\.\*\?!\|&%\^\/#\\]+/, f: fIdentifier },
{ re: /^[$a-zA-Z0-9_\-+\.\*\?!\|&%\^\/#\\]+/, f: fIdentifier },
]);

@@ -541,2 +541,24 @@ }

function stringifyPair(obj, key) {
return JSON.stringify(key) + ":" + stringify(obj[key]);
}
function stringify(obj) {
switch (typeof obj) {
case "string":
case "number":
case "boolean":
return JSON.stringify(obj);
}
if (Array.isArray(obj)) {
return "[" + obj.map(stringify).join(",") + "]";
}
if (new Object(obj) === obj) {
var keys = Object.keys(obj);
keys.sort();
return "{" + keys.map(stringifyPair.bind(null, obj)) + "}";
}
return "null";
}
// Export stuff

@@ -546,2 +568,3 @@ var RJSON = {

parse: parse,
stringify: stringify,
};

@@ -548,0 +571,0 @@

@@ -393,1 +393,12 @@ /* global describe, it */

});
describe("stringify", function () {
it("works", function () {
var property = jsc.forall(jsc.value(), function (x) {
var y = JSON.parse(rjson.stringify(x));
return _.isEqual(x, y);
});
jsc.assert(property, jscOpts);
});
});
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