jsonrepair
Advanced tools
Comparing version 3.0.1 to 3.0.2
@@ -102,3 +102,3 @@ "use strict"; | ||
function isHex(code) { | ||
return code >= codeZero && code < codeNine || code >= codeUppercaseA && code <= codeUppercaseF || code >= codeLowercaseA && code <= codeLowercaseF; | ||
return code >= codeZero && code <= codeNine || code >= codeUppercaseA && code <= codeUppercaseF || code >= codeLowercaseA && code <= codeLowercaseF; | ||
} | ||
@@ -105,0 +105,0 @@ function isDigit(code) { |
@@ -48,3 +48,3 @@ // TODO: sort the codes | ||
export function isHex(code) { | ||
return code >= codeZero && code < codeNine || code >= codeUppercaseA && code <= codeUppercaseF || code >= codeLowercaseA && code <= codeLowercaseF; | ||
return code >= codeZero && code <= codeNine || code >= codeUppercaseA && code <= codeUppercaseF || code >= codeLowercaseA && code <= codeLowercaseF; | ||
} | ||
@@ -51,0 +51,0 @@ export function isDigit(code) { |
@@ -81,3 +81,3 @@ (function (global, factory) { | ||
function isHex(code) { | ||
return code >= codeZero && code < codeNine || code >= codeUppercaseA && code <= codeUppercaseF || code >= codeLowercaseA && code <= codeLowercaseF; | ||
return code >= codeZero && code <= codeNine || code >= codeUppercaseA && code <= codeUppercaseF || code >= codeLowercaseA && code <= codeLowercaseF; | ||
} | ||
@@ -84,0 +84,0 @@ function isDigit(code) { |
@@ -1,1 +0,1 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).JSONRepair={})}(this,function(t){"use strict";function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function u(r){var n=c();return function(){var t,e=a(r),e=(t=n?(t=a(this).constructor,Reflect.construct(e,arguments,t)):e.apply(this,arguments),this);if(t&&("object"===o(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function e(t){var r="function"==typeof Map?new Map:void 0;return function(t){if(null===t||-1===Function.toString.call(t).indexOf("[native code]"))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==r){if(r.has(t))return r.get(t);r.set(t,e)}function e(){return n(t,arguments,a(this).constructor)}return e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),f(e,t)}(t)}function n(t,e,r){return(n=c()?Reflect.construct.bind():function(t,e,r){var n=[null];n.push.apply(n,e);e=new(Function.bind.apply(t,n));return r&&f(e,r.prototype),e}).apply(null,arguments)}function c(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}function f(t,e){return(f=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function a(t){return(a=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var y=function(t){var e=c;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&f(e,t);var r,n,o=u(c);function c(t,e){if(this instanceof c)return(t=o.call(this,t+" at position "+e)).position=e,t;throw new TypeError("Cannot call a class as a function")}return e=c,r&&i(e.prototype,r),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(e(Error)),r=32,C=10,A=9,v=13,g=8,w=12,O=34,l=39,j=48,m=49,x=57,h=65,d=97,s=70,p=102,S=160,P=8192,$=8202,B=8239,M=8287,U=12288,b=8220,D=8221,q=8216,z=8217,G=96,H=180;function R(t){return j<=t&&t<x||h<=t&&t<=s||d<=t&&t<=p}function _(t){return j<=t&&t<=x}var K=/^[,:[\]{}()\n]$/;function E(t){return L.test(t)||t&&N(t.charCodeAt(0))}var L=/^[[{\w-]$/;function T(t){return t===r||t===C||t===A||t===v}function N(t){return J(t)||k(t)}function J(t){return t===O||t===b||t===D}function k(t){return t===l||t===q||t===z||t===G||t===H}function I(t,e,r){r=2<arguments.length&&void 0!==r&&r,e=t.lastIndexOf(e);return-1!==e?t.substring(0,e)+(r?"":t.substring(e+1)):t}function F(t,e){var r=t.length;if(!T(t.charCodeAt(r-1)))return t+e;for(;T(t.charCodeAt(r-1));)r--;return t.substring(0,r)+e+t.substring(r)}var Q={"\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t"},V={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:"\n",r:"\r",t:"\t"};t.JSONRepairError=y,t.jsonrepair=function(u){var f=0,a="";if(!n())throw new y("Unexpected end of json string",u.length);var t=c(44);if(t&&l(),E(u[f])&&/[,\n][ \t\r]*$/.test(a)){t||(a=F(a,","));for(var e=!0,r=!0;r;)e?e=!1:c(44)||(a=F(a,",")),r=n();r||(a=I(a,",")),a="[\n".concat(a,"\n]")}else t&&(a=I(a,","));if(f>=u.length)return a;throw new y("Unexpected character "+JSON.stringify(u[f]),f);function n(){l();var t=function(){if(123!==u.charCodeAt(f))return!1;a+="{",f++,l();var t=!0;for(;f<u.length&&125!==u.charCodeAt(f);){if(t?t=!!0:(c(44)||(a=F(a,",")),l()),!(d()||s())){125===u.charCodeAt(f)||123===u.charCodeAt(f)||93===u.charCodeAt(f)||91===u.charCodeAt(f)||void 0===u[f]?a=I(a,","):function(){throw new y("Object key expected",f)}();break}l();var e=c(58);e||(E(u[f])?a=F(a,":"):b()),n()||(e?function(){throw new y("Object value expected",f)}:b)()}125===u.charCodeAt(f)?(a+="}",f++):a=F(a,"}");return!0}()||function(){if(91!==u.charCodeAt(f))return!1;a+="[",f++,l();var t=!0;for(;f<u.length&&93!==u.charCodeAt(f);)if(t?t=!1:c(44)||(a=F(a,",")),!n()){a=I(a,",");break}93===u.charCodeAt(f)?(a+="]",f++):a=F(a,"]");return!0}()||d()||function(){var t=f;45===u.charCodeAt(f)&&(f++,p(t));if(u.charCodeAt(f)===j)f++;else if(function(t){return m<=t&&t<=x}(u.charCodeAt(f)))for(f++;_(u.charCodeAt(f));)f++;if(46===u.charCodeAt(f))for(f++,p(t);_(u.charCodeAt(f));)f++;if(101===u.charCodeAt(f)||69===u.charCodeAt(f))for(f++,45!==u.charCodeAt(f)&&43!==u.charCodeAt(f)||f++,p(t);_(u.charCodeAt(f));)f++;if(t<f)return a+=u.slice(t,f),!0;return!1}()||i("true","true")||i("false","false")||i("null","null")||i("True","true")||i("False","false")||i("None","null")||s();return l(),t}function l(){for(o();function(){if(47===u.charCodeAt(f)&&42===u.charCodeAt(f+1)){for(;f<u.length&&!function(t,e){return"*"===t[e]&&"/"===t[e+1]}(u,f);)f++;f+=2}else{if(47!==u.charCodeAt(f)||47!==u.charCodeAt(f+1))return!1;for(;f<u.length&&u.charCodeAt(f)!==C;)f++}return!0}()&&o(););}function o(){for(var t,e,r="";(t=T(u.charCodeAt(f)))||(e=u.charCodeAt(f))===S||P<=e&&e<=$||e===B||e===M||e===U;)r+=t?u[f]:" ",f++;return 0<r.length&&(a+=r,!0)}function c(t){return u.charCodeAt(f)===t&&(a+=u[f],f++,!0)}function h(){92===u.charCodeAt(f)&&f++}function d(){var t,e=92===u.charCodeAt(f);if(e&&(f++,e=!0),N(u.charCodeAt(f))){var r=k(u.charCodeAt(f))?k:J;for(u.charCodeAt(f),a+='"',f++;f<u.length&&!r(u.charCodeAt(f));){if(92===u.charCodeAt(f)){var n=u[f+1];if(void 0!==V[n])a+=u.slice(f,f+2),f+=2;else if("u"===n){if(!(R(u.charCodeAt(f+2))&&R(u.charCodeAt(f+3))&&R(u.charCodeAt(f+4))&&R(u.charCodeAt(f+5)))){c=o=void 0;for(var o=f,c=o+2;/\w/.test(u[c]);)c++;throw o=u.slice(o,c),new y('Invalid unicode character "'.concat(o,'"'),f)}a+=u.slice(f,f+6),f+=6}else a+=n,f+=2}else{o=u[f],n=u.charCodeAt(f);if(n===O&&92!==u.charCodeAt(f-1))a+="\\"+o;else if((t=n)===C||t===v||t===A||t===g||t===w)a+=Q[o];else{if(!(32<=(t=n)&&t<=1114111))throw new y("Invalid character "+JSON.stringify(o),f);a+=o}f++}e&&h()}N(u.charCodeAt(f))?(u.charCodeAt(f),a+='"',f++):a+='"';for(l();43===u.charCodeAt(f);){f++,l();var i=(a=I(a,'"',!0)).length;d(),a=function(t,e,r){return t.substring(0,e)+t.substring(e+r)}(a,i,1)}return!0}return!1}function i(t,e){return u.slice(f,f+t.length)===t&&(a+=e,f+=t.length,!0)}function s(){for(var t,e=f;f<u.length&&(t=u[f],!(K.test(t)||t&&N(t.charCodeAt(0))));)f++;if(e<f){if(40===u.charCodeAt(f))f++,n(),41===u.charCodeAt(f)&&(f++,59===u.charCodeAt(f))&&f++;else{for(;T(u.charCodeAt(f-1))&&0<f;)f--;e=u.slice(e,f);a+=JSON.stringify(e)}return!0}}function p(t){if(!_(u.charCodeAt(f)))throw t=u.slice(t,f),new y("Invalid number '".concat(t,"', expecting a digit ").concat(u[f]?"but got '".concat(u[f],"'"):"but reached end of input"),2)}function b(){throw new y("Colon expected",f)}}}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).JSONRepair={})}(this,function(t){"use strict";function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function u(r){var n=c();return function(){var t,e=a(r),e=(t=n?(t=a(this).constructor,Reflect.construct(e,arguments,t)):e.apply(this,arguments),this);if(t&&("object"===o(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function e(t){var r="function"==typeof Map?new Map:void 0;return function(t){if(null===t||-1===Function.toString.call(t).indexOf("[native code]"))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==r){if(r.has(t))return r.get(t);r.set(t,e)}function e(){return n(t,arguments,a(this).constructor)}return e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),f(e,t)}(t)}function n(t,e,r){return(n=c()?Reflect.construct.bind():function(t,e,r){var n=[null];n.push.apply(n,e);e=new(Function.bind.apply(t,n));return r&&f(e,r.prototype),e}).apply(null,arguments)}function c(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}function f(t,e){return(f=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function a(t){return(a=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var y=function(t){var e=c;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&f(e,t);var r,n,o=u(c);function c(t,e){if(this instanceof c)return(t=o.call(this,t+" at position "+e)).position=e,t;throw new TypeError("Cannot call a class as a function")}return e=c,r&&i(e.prototype,r),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(e(Error)),r=32,C=10,A=9,v=13,g=8,w=12,O=34,l=39,j=48,m=49,x=57,h=65,d=97,s=70,p=102,S=160,P=8192,$=8202,B=8239,M=8287,U=12288,b=8220,D=8221,q=8216,z=8217,G=96,H=180;function R(t){return j<=t&&t<=x||h<=t&&t<=s||d<=t&&t<=p}function _(t){return j<=t&&t<=x}var K=/^[,:[\]{}()\n]$/;function E(t){return L.test(t)||t&&N(t.charCodeAt(0))}var L=/^[[{\w-]$/;function T(t){return t===r||t===C||t===A||t===v}function N(t){return J(t)||k(t)}function J(t){return t===O||t===b||t===D}function k(t){return t===l||t===q||t===z||t===G||t===H}function I(t,e,r){r=2<arguments.length&&void 0!==r&&r,e=t.lastIndexOf(e);return-1!==e?t.substring(0,e)+(r?"":t.substring(e+1)):t}function F(t,e){var r=t.length;if(!T(t.charCodeAt(r-1)))return t+e;for(;T(t.charCodeAt(r-1));)r--;return t.substring(0,r)+e+t.substring(r)}var Q={"\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t"},V={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:"\n",r:"\r",t:"\t"};t.JSONRepairError=y,t.jsonrepair=function(u){var f=0,a="";if(!n())throw new y("Unexpected end of json string",u.length);var t=c(44);if(t&&l(),E(u[f])&&/[,\n][ \t\r]*$/.test(a)){t||(a=F(a,","));for(var e=!0,r=!0;r;)e?e=!1:c(44)||(a=F(a,",")),r=n();r||(a=I(a,",")),a="[\n".concat(a,"\n]")}else t&&(a=I(a,","));if(f>=u.length)return a;throw new y("Unexpected character "+JSON.stringify(u[f]),f);function n(){l();var t=function(){if(123!==u.charCodeAt(f))return!1;a+="{",f++,l();var t=!0;for(;f<u.length&&125!==u.charCodeAt(f);){if(t?t=!!0:(c(44)||(a=F(a,",")),l()),!(d()||s())){125===u.charCodeAt(f)||123===u.charCodeAt(f)||93===u.charCodeAt(f)||91===u.charCodeAt(f)||void 0===u[f]?a=I(a,","):function(){throw new y("Object key expected",f)}();break}l();var e=c(58);e||(E(u[f])?a=F(a,":"):b()),n()||(e?function(){throw new y("Object value expected",f)}:b)()}125===u.charCodeAt(f)?(a+="}",f++):a=F(a,"}");return!0}()||function(){if(91!==u.charCodeAt(f))return!1;a+="[",f++,l();var t=!0;for(;f<u.length&&93!==u.charCodeAt(f);)if(t?t=!1:c(44)||(a=F(a,",")),!n()){a=I(a,",");break}93===u.charCodeAt(f)?(a+="]",f++):a=F(a,"]");return!0}()||d()||function(){var t=f;45===u.charCodeAt(f)&&(f++,p(t));if(u.charCodeAt(f)===j)f++;else if(function(t){return m<=t&&t<=x}(u.charCodeAt(f)))for(f++;_(u.charCodeAt(f));)f++;if(46===u.charCodeAt(f))for(f++,p(t);_(u.charCodeAt(f));)f++;if(101===u.charCodeAt(f)||69===u.charCodeAt(f))for(f++,45!==u.charCodeAt(f)&&43!==u.charCodeAt(f)||f++,p(t);_(u.charCodeAt(f));)f++;if(t<f)return a+=u.slice(t,f),!0;return!1}()||i("true","true")||i("false","false")||i("null","null")||i("True","true")||i("False","false")||i("None","null")||s();return l(),t}function l(){for(o();function(){if(47===u.charCodeAt(f)&&42===u.charCodeAt(f+1)){for(;f<u.length&&!function(t,e){return"*"===t[e]&&"/"===t[e+1]}(u,f);)f++;f+=2}else{if(47!==u.charCodeAt(f)||47!==u.charCodeAt(f+1))return!1;for(;f<u.length&&u.charCodeAt(f)!==C;)f++}return!0}()&&o(););}function o(){for(var t,e,r="";(t=T(u.charCodeAt(f)))||(e=u.charCodeAt(f))===S||P<=e&&e<=$||e===B||e===M||e===U;)r+=t?u[f]:" ",f++;return 0<r.length&&(a+=r,!0)}function c(t){return u.charCodeAt(f)===t&&(a+=u[f],f++,!0)}function h(){92===u.charCodeAt(f)&&f++}function d(){var t,e=92===u.charCodeAt(f);if(e&&(f++,e=!0),N(u.charCodeAt(f))){var r=k(u.charCodeAt(f))?k:J;for(u.charCodeAt(f),a+='"',f++;f<u.length&&!r(u.charCodeAt(f));){if(92===u.charCodeAt(f)){var n=u[f+1];if(void 0!==V[n])a+=u.slice(f,f+2),f+=2;else if("u"===n){if(!(R(u.charCodeAt(f+2))&&R(u.charCodeAt(f+3))&&R(u.charCodeAt(f+4))&&R(u.charCodeAt(f+5)))){c=o=void 0;for(var o=f,c=o+2;/\w/.test(u[c]);)c++;throw o=u.slice(o,c),new y('Invalid unicode character "'.concat(o,'"'),f)}a+=u.slice(f,f+6),f+=6}else a+=n,f+=2}else{o=u[f],n=u.charCodeAt(f);if(n===O&&92!==u.charCodeAt(f-1))a+="\\"+o;else if((t=n)===C||t===v||t===A||t===g||t===w)a+=Q[o];else{if(!(32<=(t=n)&&t<=1114111))throw new y("Invalid character "+JSON.stringify(o),f);a+=o}f++}e&&h()}N(u.charCodeAt(f))?(u.charCodeAt(f),a+='"',f++):a+='"';for(l();43===u.charCodeAt(f);){f++,l();var i=(a=I(a,'"',!0)).length;d(),a=function(t,e,r){return t.substring(0,e)+t.substring(e+r)}(a,i,1)}return!0}return!1}function i(t,e){return u.slice(f,f+t.length)===t&&(a+=e,f+=t.length,!0)}function s(){for(var t,e=f;f<u.length&&(t=u[f],!(K.test(t)||t&&N(t.charCodeAt(0))));)f++;if(e<f){if(40===u.charCodeAt(f))f++,n(),41===u.charCodeAt(f)&&(f++,59===u.charCodeAt(f))&&f++;else{for(;T(u.charCodeAt(f-1))&&0<f;)f--;e=u.slice(e,f);a+=JSON.stringify(e)}return!0}}function p(t){if(!_(u.charCodeAt(f)))throw t=u.slice(t,f),new y("Invalid number '".concat(t,"', expecting a digit ").concat(u[f]?"but got '".concat(u[f],"'"):"but reached end of input"),2)}function b(){throw new y("Colon expected",f)}}}); |
The ISC License | ||
Copyright (c) 2020-2021 by Jos de Jong | ||
Copyright (c) 2020-2023 by Jos de Jong | ||
@@ -5,0 +5,0 @@ Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. |
{ | ||
"name": "jsonrepair", | ||
"version": "3.0.1", | ||
"version": "3.0.2", | ||
"description": "Repair broken JSON documents", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -172,8 +172,15 @@ # jsonrepair | ||
This will list, test, and build the project. Then it will up the version number (using `standard-version`), push the changes to git, add a git version tag, and then publish the npm package. | ||
This will: | ||
- lint | ||
- test | ||
- build | ||
- increment the version number | ||
- push the changes to git, add a git version tag | ||
- publish the npm package | ||
To try the build and see the change list without actually publishing: | ||
``` | ||
$ npm publish-dry-run | ||
$ npm run publish-dry-run | ||
``` | ||
@@ -180,0 +187,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
191
260507