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.3 to 0.2.4

relaxed-json.min.map

8

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

@@ -32,8 +32,8 @@ "author": {

"devDependencies": {
"grunt-contrib-jshint": "~0.6.4",
"grunt-contrib-jshint": "~0.8.0",
"grunt": "~0.4.1",
"grunt-contrib-uglify": "~0.2.5",
"grunt-contrib-uglify": "~0.3.2",
"grunt-simple-mocha": "~0.4.0",
"jsverify": "~0.1.2",
"underscore": "~1.5.2"
"underscore": "~1.6.0"
},

@@ -40,0 +40,0 @@ "keywords": [

# Relaxed JSON
[![Build Status](https://secure.travis-ci.org/phadej/jsverify.png?branch=master)](http://travis-ci.org/phadej/jsverify)
[![Build Status](https://secure.travis-ci.org/phadej/relaxed-json.png?branch=master)](http://travis-ci.org/phadej/relaxed-json)
[![NPM version](https://badge.fury.io/js/relaxed-json.png)](http://badge.fury.io/js/relaxed-json)

@@ -39,2 +39,3 @@ [![Dependency Status](https://gemnasium.com/phadej/relaxed-json.png)](https://gemnasium.com/phadej/relaxed-json)

- 0.2.4 Maintenance release
- 0.2.3 Bugfixes

@@ -41,0 +42,0 @@ - `$` is valid identifier character

@@ -88,9 +88,9 @@ /*

// String in single quotes
var content = m[1].replace(/([^'\\]|\\['bnrtf\\]|\\u[0-9a-fA-F]{4})/g, function (m) {
if (m === "\"") {
var content = m[1].replace(/([^'\\]|\\['bnrtf\\]|\\u[0-9a-fA-F]{4})/g, function (mm) {
if (mm === "\"") {
return "\\\"";
} else if (m === "\\'") {
} else if (mm === "\\'") {
return "'";
} else {
return m;
return mm;
}

@@ -97,0 +97,0 @@ });

@@ -1,2 +0,2 @@

!function(){"use strict";function a(a,b){for(var c=!1,d=0;d<a.length;d++)if(c=b(a[d],d,a))return c;return c}function b(b){return function(c){function d(){return a(b,function(a){var b=a.re.exec(c);if(b){var d=b[0];return c=c.slice(d.length),{raw:d,matched:a.f(b,f)}}})}for(var e=[],f=1;""!==c;){var g=d();if(!g){var h=new SyntaxError("Unexpected character: "+c[0]);throw h.line=f,h}g.matched.line=f,f+=g.raw.replace(/[^\n]/g,"").length,e.push(g.matched)}return e}}function c(a){var b=a[1].replace(/([^'\\]|\\['bnrtf\\]|\\u[0-9a-fA-F]{4})/g,function(a){return'"'===a?'\\"':"\\'"===a?"'":a});return{type:"string",match:'"'+b+'"',value:JSON.parse('"'+b+'"')}}function d(a){return{type:"string",match:a[0],value:JSON.parse(a[0])}}function e(a){return{type:"string",value:a[0],match:'"'+a[0].replace(/./g,function(a){return"\\"===a?"\\\\":a})+'"'}}function f(a){return{type:" ",match:a[0].replace(/./g,function(a){return/\s/.test(a)?a:" "})}}function g(a){return{type:"number",match:a[0],value:parseFloat(a[0])}}function h(a){var b;switch(a[1]){case"null":b=null;break;case"true":b=!0;break;case"false":b=!1}return{type:"atom",match:a[0],value:b}}function i(a){function b(a){return function(b){return{type:a,match:b[0]}}}var i=[{re:/^\s+/,f:b(" ")},{re:/^\{/,f:b("{")},{re:/^\}/,f:b("}")},{re:/^\[/,f:b("[")},{re:/^\]/,f:b("]")},{re:/^,/,f:b(",")},{re:/^:/,f:b(":")},{re:/^(true|false|null)/,f:h},{re:/^\-?\d+(\.\d+)?([eE][+-]?\d+)?/,f:g},{re:/^"([^"\\]|\\["bnrtf\\]|\\u[0-9a-fA-F]{4})*"/,f:d}];return a&&(i=i.concat([{re:/^'(([^'\\]|\\['bnrtf\\]|\\u[0-9a-fA-F]{4})*)'/,f:c},{re:/^\/\/.*?\n/,f:f},{re:/^\/\*[\s\S]*?\*\//,f:f},{re:/^[a-zA-Z0-9_\-+\.\*\?!\|&%\^\/#\\]+/,f:e}])),i}function j(a,b){for(;b>=0;b--)if(" "!==a[b].type)return b}function k(a){var b=[];return a.forEach(function(c,d){if("]"===c.type||"}"===c.type){var e=j(b,d-1);if(e&&","===b[e].type){var f=j(b,e-1);f&&"["!==b[f].type&&"{"!==b[f].type&&(b[e]={type:" ",match:" ",line:a[e].line})}}b.push(c)}),b}function l(a){var b=C(a);return b=k(b),b.reduce(function(a,b){return a+b.match},"")}function m(a,b){var c=a[b.pos];if(b.pos+=1,!c){var d=0!==a.length?a[a.length-1].line:1;return{type:"eof",line:d}}return c}function n(a){switch(a.type){case"atom":case"string":case"number":return a.type+" "+a.match;case"eof":return"end-of-file";default:return"'"+a.type+"'"}}function o(a,b){var c=m(a,b);if(":"!==c.type){var d="Unexpected token: "+n(c)+", expected ':'";if(!b.tolerant){var e=new SyntaxError(d);throw e.line=c.line,e}b.warnings.push({message:d,line:c.line}),b.pos-=1}}function p(a,b,c){for(var d=[",",":","]","}"],e=m(a,b);;){if(c&&-1!==c.indexOf(e.type))return e;if("eof"===e.type)return e;if(-1===d.indexOf(e.type))return e;var f="Unexpected token: "+n(e)+", expected '[', '{', number, string or atom";if(!b.tolerant){var g=new SyntaxError(f);throw g.line=e.line,g}b.warnings.push({message:f,line:e.line}),e=m(a,b)}}function q(a,b,c){if(!a.tolerant){var d=new SyntaxError(c);throw d.line=b.line,d}a.warnings.push({message:c,line:b.line})}function r(a,b,c){q(a,b,"Unexpected token: "+n(b)+", expected "+c)}function s(a,b,c){var d=c.value;a.duplicate&&Object.prototype.hasOwnProperty.call(b,d)&&q(a,c,"Duplicate key: "+d)}function t(a,b,c,d){d=a.reviver?a.reviver(c,d):d,void 0!==d&&(b[c]=d)}function u(a,b,c){var d,e,f=p(a,b,[":"]);if("string"!==f.type)switch(r(b,f,"string"),f.type){case":":f={type:"string",value:"null",line:f.line},b.pos-=1;break;case"number":case"atom":f={type:"string",value:""+f.value,line:f.line};break;case"[":case"{":return b.pos-=1,e=A(a,b),t(b,c,"null",e),void 0}s(b,c,f),d=f.value,o(a,b),e=A(a,b),t(b,c,d,e)}function v(a,b,c){var d=c.length,e=A(a,b);c[d]=b.reviver?b.reviver(""+d,e):e}function w(a,b){return y(a,b,{},{skip:[":","}"],elementParser:u,elementName:"string",endSymbol:"}"})}function x(a,b){return y(a,b,[],{skip:["]"],elementParser:v,elementName:"json object",endSymbol:"]"})}function y(a,b,c,d){var e=p(a,b,d.skip);switch("eof"===e.type&&(r(b,e,"'"+d.endSymbol+"' or "+d.elementName),e={type:d.endSymbol,line:e.line}),e.type){case d.endSymbol:return c;default:b.pos-=1,d.elementParser(a,b,c)}for(;;)switch(e=m(a,b),e.type!==d.endSymbol&&","!==e.type&&(r(b,e,"',' or '"+d.endSymbol+"'"),e={type:"eof"===e.type?d.endSymbol:",",line:e.line},b.pos-=1),e.type){case d.endSymbol:return c;case",":d.elementParser(a,b,c)}}function z(a,b,c){if(b.pos<a.length&&q(b,a[b.pos],"Unexpected token: "+n(a[b.pos])+", expected end-of-input"),b.tolerant&&0!==b.warnings.length){var d=1===b.warnings.length?b.warnings[0].message:b.warnings.length+" parse warnings",e=new SyntaxError(d);throw e.line=b.warnings[0].line,e.warnings=b.warnings,e.obj=c,e}}function A(a,b,c){var d,e=p(a,b);switch("eof"===e.type&&r(b,e,"json object"),e.type){case"{":d=w(a,b);break;case"[":d=x(a,b);break;case"string":case"number":case"atom":d=e.value}return c&&(d=b.reviver?b.reviver("",d):d,z(a,b,d)),d}function B(a,b){if("function"==typeof b||void 0===b)return JSON.parse(l(a),b);if(new Object(b)!==b)throw new TypeError("opts/reviver should be undefined, a function or an object");if(b.relaxed=void 0!==b.relaxed?b.relaxed:!0,b.warnings=b.warnings||b.tolerant||!1,b.tolerant=b.tolerant||!1,b.duplicate=b.duplicate||!1,!b.warnings&&!b.relaxed)return JSON.parse(a,b.reviver);var c=b.relaxed?C(a):D(a);if(b.relaxed&&(c=k(c)),b.warnings){c=c.filter(function(a){return" "!==a.type});var d={pos:0,reviver:b.reviver,tolerant:b.tolerant,duplicate:b.duplicate,warnings:[]};return A(c,d,!0)}var e=c.reduce(function(a,b){return a+b.match},"");return JSON.parse(e,b.reviver)}var C=b(i(!0)),D=b(i(!1)),E={transform:l,parse:B};"undefined"!=typeof window?window.RJSON=E:"undefined"!=typeof module&&(module.exports=E)}();
//# sourceMappingURL=relaxed-json.min.js.map
!function(){"use strict";function a(a,b){for(var c=!1,d=0;d<a.length;d++)if(c=b(a[d],d,a))return c;return c}function b(b){return function(c){function d(){return a(b,function(a){var b=a.re.exec(c);if(b){var d=b[0];return c=c.slice(d.length),{raw:d,matched:a.f(b,f)}}})}for(var e=[],f=1;""!==c;){var g=d();if(!g){var h=new SyntaxError("Unexpected character: "+c[0]);throw h.line=f,h}g.matched.line=f,f+=g.raw.replace(/[^\n]/g,"").length,e.push(g.matched)}return e}}function c(a){var b=a[1].replace(/([^'\\]|\\['bnrtf\\]|\\u[0-9a-fA-F]{4})/g,function(a){return'"'===a?'\\"':"\\'"===a?"'":a});return{type:"string",match:'"'+b+'"',value:JSON.parse('"'+b+'"')}}function d(a){return{type:"string",match:a[0],value:JSON.parse(a[0])}}function e(a){return{type:"string",value:a[0],match:'"'+a[0].replace(/./g,function(a){return"\\"===a?"\\\\":a})+'"'}}function f(a){return{type:" ",match:a[0].replace(/./g,function(a){return/\s/.test(a)?a:" "})}}function g(a){return{type:"number",match:a[0],value:parseFloat(a[0])}}function h(a){var b;switch(a[1]){case"null":b=null;break;case"true":b=!0;break;case"false":b=!1}return{type:"atom",match:a[0],value:b}}function i(a){function b(a){return function(b){return{type:a,match:b[0]}}}var i=[{re:/^\s+/,f:b(" ")},{re:/^\{/,f:b("{")},{re:/^\}/,f:b("}")},{re:/^\[/,f:b("[")},{re:/^\]/,f:b("]")},{re:/^,/,f:b(",")},{re:/^:/,f:b(":")},{re:/^(true|false|null)/,f:h},{re:/^\-?\d+(\.\d+)?([eE][+-]?\d+)?/,f:g},{re:/^"([^"\\]|\\["bnrtf\\]|\\u[0-9a-fA-F]{4})*"/,f:d}];return a&&(i=i.concat([{re:/^'(([^'\\]|\\['bnrtf\\]|\\u[0-9a-fA-F]{4})*)'/,f:c},{re:/^\/\/.*?(?:\r\n|\r|\n)/,f:f},{re:/^\/\*[\s\S]*?\*\//,f:f},{re:/^[$a-zA-Z0-9_\-+\.\*\?!\|&%\^\/#\\]+/,f:e}])),i}function j(a,b){for(;b>=0;b--)if(" "!==a[b].type)return b}function k(a){var b=[];return a.forEach(function(c,d){if("]"===c.type||"}"===c.type){var e=j(b,d-1);if(e&&","===b[e].type){var f=j(b,e-1);f&&"["!==b[f].type&&"{"!==b[f].type&&(b[e]={type:" ",match:" ",line:a[e].line})}}b.push(c)}),b}function l(a){var b=E(a);return b=k(b),b.reduce(function(a,b){return a+b.match},"")}function m(a,b){var c=a[b.pos];if(b.pos+=1,!c){var d=0!==a.length?a[a.length-1].line:1;return{type:"eof",line:d}}return c}function n(a){switch(a.type){case"atom":case"string":case"number":return a.type+" "+a.match;case"eof":return"end-of-file";default:return"'"+a.type+"'"}}function o(a,b){var c=m(a,b);if(":"!==c.type){var d="Unexpected token: "+n(c)+", expected ':'";if(!b.tolerant){var e=new SyntaxError(d);throw e.line=c.line,e}b.warnings.push({message:d,line:c.line}),b.pos-=1}}function p(a,b,c){for(var d=[",",":","]","}"],e=m(a,b);;){if(c&&-1!==c.indexOf(e.type))return e;if("eof"===e.type)return e;if(-1===d.indexOf(e.type))return e;var f="Unexpected token: "+n(e)+", expected '[', '{', number, string or atom";if(!b.tolerant){var g=new SyntaxError(f);throw g.line=e.line,g}b.warnings.push({message:f,line:e.line}),e=m(a,b)}}function q(a,b,c){if(!a.tolerant){var d=new SyntaxError(c);throw d.line=b.line,d}a.warnings.push({message:c,line:b.line})}function r(a,b,c){q(a,b,"Unexpected token: "+n(b)+", expected "+c)}function s(a,b,c){var d=c.value;a.duplicate&&Object.prototype.hasOwnProperty.call(b,d)&&q(a,c,"Duplicate key: "+d)}function t(a,b,c,d){d=a.reviver?a.reviver(c,d):d,void 0!==d&&(b[c]=d)}function u(a,b,c){var d,e,f=p(a,b,[":"]);if("string"!==f.type)switch(r(b,f,"string"),f.type){case":":f={type:"string",value:"null",line:f.line},b.pos-=1;break;case"number":case"atom":f={type:"string",value:""+f.value,line:f.line};break;case"[":case"{":return b.pos-=1,e=A(a,b),void t(b,c,"null",e)}s(b,c,f),d=f.value,o(a,b),e=A(a,b),t(b,c,d,e)}function v(a,b,c){var d=c.length,e=A(a,b);c[d]=b.reviver?b.reviver(""+d,e):e}function w(a,b){return y(a,b,{},{skip:[":","}"],elementParser:u,elementName:"string",endSymbol:"}"})}function x(a,b){return y(a,b,[],{skip:["]"],elementParser:v,elementName:"json object",endSymbol:"]"})}function y(a,b,c,d){var e=p(a,b,d.skip);switch("eof"===e.type&&(r(b,e,"'"+d.endSymbol+"' or "+d.elementName),e={type:d.endSymbol,line:e.line}),e.type){case d.endSymbol:return c;default:b.pos-=1,d.elementParser(a,b,c)}for(;;)switch(e=m(a,b),e.type!==d.endSymbol&&","!==e.type&&(r(b,e,"',' or '"+d.endSymbol+"'"),e={type:"eof"===e.type?d.endSymbol:",",line:e.line},b.pos-=1),e.type){case d.endSymbol:return c;case",":d.elementParser(a,b,c)}}function z(a,b,c){if(b.pos<a.length&&q(b,a[b.pos],"Unexpected token: "+n(a[b.pos])+", expected end-of-input"),b.tolerant&&0!==b.warnings.length){var d=1===b.warnings.length?b.warnings[0].message:b.warnings.length+" parse warnings",e=new SyntaxError(d);throw e.line=b.warnings[0].line,e.warnings=b.warnings,e.obj=c,e}}function A(a,b,c){var d,e=p(a,b);switch("eof"===e.type&&r(b,e,"json object"),e.type){case"{":d=w(a,b);break;case"[":d=x(a,b);break;case"string":case"number":case"atom":d=e.value}return c&&(d=b.reviver?b.reviver("",d):d,z(a,b,d)),d}function B(a,b){if("function"==typeof b||void 0===b)return JSON.parse(l(a),b);if(new Object(b)!==b)throw new TypeError("opts/reviver should be undefined, a function or an object");if(b.relaxed=void 0!==b.relaxed?b.relaxed:!0,b.warnings=b.warnings||b.tolerant||!1,b.tolerant=b.tolerant||!1,b.duplicate=b.duplicate||!1,!b.warnings&&!b.relaxed)return JSON.parse(a,b.reviver);var c=b.relaxed?E(a):F(a);if(b.relaxed&&(c=k(c)),b.warnings){c=c.filter(function(a){return" "!==a.type});var d={pos:0,reviver:b.reviver,tolerant:b.tolerant,duplicate:b.duplicate,warnings:[]};return A(c,d,!0)}var e=c.reduce(function(a,b){return a+b.match},"");return JSON.parse(e,b.reviver)}function C(a,b){return JSON.stringify(b)+":"+D(a[b])}function D(a){switch(typeof a){case"string":case"number":case"boolean":return JSON.stringify(a)}if(Array.isArray(a))return"["+a.map(D).join(",")+"]";if(new Object(a)===a){var b=Object.keys(a);return b.sort(),"{"+b.map(C.bind(null,a))+"}"}return"null"}var E=b(i(!0)),F=b(i(!1)),G={transform:l,parse:B,stringify:D};"undefined"!=typeof window?window.RJSON=G:"undefined"!=typeof module&&(module.exports=G)}();
//# sourceMappingURL=relaxed-json.min.map

Sorry, the diff of this file is not supported yet

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