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

jsonrepair

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jsonrepair - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

5

CHANGELOG.md
# Changelog
## 2021-03-01, version 2.0.1
- Performance improvements.
## 2021-01-13, version 2.0.0

@@ -4,0 +9,0 @@

11

lib/cjs/jsonrepair.js

@@ -118,4 +118,8 @@ "use strict";

// newline delimited JSON -> turn into a root level array
var stashedOutput = '';
while (tokenIsStartOfValue()) {
output = (0, _stringUtils.insertBeforeLastWhitespace)(output, ','); // parse next newline delimited item
output = (0, _stringUtils.insertBeforeLastWhitespace)(output, ',');
stashedOutput += output;
output = ''; // parse next newline delimited item

@@ -126,3 +130,3 @@ parseObject();

return "[\n".concat(output, "\n]");
return "[\n".concat(stashedOutput).concat(output, "\n]");
}

@@ -267,2 +271,3 @@

var quote = (0, _stringUtils.normalizeQuote)(c);
var isEndQuote = (0, _stringUtils.isSingleQuote)(c) ? _stringUtils.isSingleQuote : _stringUtils.isDoubleQuote;
token += '"'; // output valid double quote

@@ -273,3 +278,3 @@

while (c !== '' && (0, _stringUtils.normalizeQuote)(c) !== quote) {
while (c !== '' && !isEndQuote(c)) {
if (c === '\\') {

@@ -276,0 +281,0 @@ // handle escape characters

@@ -13,2 +13,4 @@ "use strict";

exports.isQuote = isQuote;
exports.isSingleQuote = isSingleQuote;
exports.isDoubleQuote = isDoubleQuote;
exports.normalizeQuote = normalizeQuote;

@@ -18,11 +20,21 @@ exports.stripLastOccurrence = stripLastOccurrence;

exports.insertAtIndex = insertAtIndex;
var SINGLE_QUOTES = ['\'', // quote
"\u2018", // quote left
"\u2019", // quote right
"`", // grave accent
"\xB4" // acute accent
];
var DOUBLE_QUOTES = ['"', "\u201C", // double quote left
"\u201D" // double quote right
];
var SINGLE_QUOTES = {
'\'': true,
// quote
"\u2018": true,
// quote left
"\u2019": true,
// quote right
"`": true,
// grave accent
"\xB4": true // acute accent
};
var DOUBLE_QUOTES = {
'"': true,
"\u201C": true,
// double quote left
"\u201D": true // double quote right
};
/**

@@ -35,4 +47,6 @@ * Check if the given character contains an alpha character, a-z, A-Z, _

function isAlpha(c) {
return /^[a-zA-Z_]$/.test(c);
return ALPHA_REGEX.test(c);
}
var ALPHA_REGEX = /^[a-zA-Z_]$/;
/**

@@ -44,6 +58,7 @@ * Check if the given character contains a hexadecimal character 0-9, a-f, A-F

function isHex(c) {
return /^[0-9a-fA-F]$/.test(c);
return HEX_REGEX.test(c);
}
var HEX_REGEX = /^[0-9a-fA-F]$/;
/**

@@ -55,6 +70,7 @@ * checks if the given char c is a digit

function isDigit(c) {
return c >= '0' && c <= '9';
return DIGIT_REGEX.test(c);
}
var DIGIT_REGEX = /^[0-9]$/;
/**

@@ -67,3 +83,2 @@ * Check if the given character is a whitespace character like space, tab, or

function isWhitespace(c) {

@@ -109,5 +124,27 @@ return c === ' ' || c === '\t' || c === '\n' || c === '\r';

function isQuote(c) {
return SINGLE_QUOTES.includes(c) || DOUBLE_QUOTES.includes(c);
return SINGLE_QUOTES[c] === true || DOUBLE_QUOTES[c] === true;
}
/**
* Test whether the given character is a single quote character.
* Also tests for special variants of single quotes.
* @param {string} c
* @returns {boolean}
*/
function isSingleQuote(c) {
return SINGLE_QUOTES[c] === true;
}
/**
* Test whether the given character is a double quote character.
* Also tests for special variants of double quotes.
* @param {string} c
* @returns {boolean}
*/
function isDoubleQuote(c) {
return DOUBLE_QUOTES[c] === true;
}
/**
* Normalize special double or single quote characters to their regular

@@ -121,7 +158,7 @@ * variant ' or "

function normalizeQuote(c) {
if (SINGLE_QUOTES.includes(c)) {
if (SINGLE_QUOTES[c] === true) {
return '\'';
}
if (DOUBLE_QUOTES.includes(c)) {
if (DOUBLE_QUOTES[c] === true) {
return '"';

@@ -153,5 +190,14 @@ }

function insertBeforeLastWhitespace(text, textToInsert) {
return text.replace(/\s*$/, function (match) {
return textToInsert + match;
});
var index = text.length;
if (!isWhitespace(text[index - 1])) {
// no trailing whitespaces
return text + textToInsert;
}
while (isWhitespace(text[index - 1])) {
index--;
}
return text.substring(0, index) + textToInsert + text.substring(index);
}

@@ -158,0 +204,0 @@ /**

import JsonRepairError from './JsonRepairError.js';
import { insertAtIndex, insertBeforeLastWhitespace, isAlpha, isDigit, isHex, isQuote, isSpecialWhitespace, isWhitespace, normalizeQuote, normalizeWhitespace, stripLastOccurrence } from './stringUtils.js'; // token types enumeration
import { insertAtIndex, insertBeforeLastWhitespace, isAlpha, isDigit, isDoubleQuote, isHex, isQuote, isSingleQuote, isSpecialWhitespace, isWhitespace, normalizeQuote, normalizeWhitespace, stripLastOccurrence } from './stringUtils.js'; // token types enumeration

@@ -107,4 +107,8 @@ var DELIMITER = 0;

// newline delimited JSON -> turn into a root level array
var stashedOutput = '';
while (tokenIsStartOfValue()) {
output = insertBeforeLastWhitespace(output, ','); // parse next newline delimited item
output = insertBeforeLastWhitespace(output, ',');
stashedOutput += output;
output = ''; // parse next newline delimited item

@@ -115,3 +119,3 @@ parseObject();

return "[\n".concat(output, "\n]");
return "[\n".concat(stashedOutput).concat(output, "\n]");
}

@@ -255,2 +259,3 @@

var quote = normalizeQuote(c);
var isEndQuote = isSingleQuote(c) ? isSingleQuote : isDoubleQuote;
token += '"'; // output valid double quote

@@ -261,3 +266,3 @@

while (c !== '' && normalizeQuote(c) !== quote) {
while (c !== '' && !isEndQuote(c)) {
if (c === '\\') {

@@ -264,0 +269,0 @@ // handle escape characters

@@ -1,10 +0,20 @@

var SINGLE_QUOTES = ['\'', // quote
"\u2018", // quote left
"\u2019", // quote right
"`", // grave accent
"\xB4" // acute accent
];
var DOUBLE_QUOTES = ['"', "\u201C", // double quote left
"\u201D" // double quote right
];
var SINGLE_QUOTES = {
'\'': true,
// quote
"\u2018": true,
// quote left
"\u2019": true,
// quote right
"`": true,
// grave accent
"\xB4": true // acute accent
};
var DOUBLE_QUOTES = {
'"': true,
"\u201C": true,
// double quote left
"\u201D": true // double quote right
};
/**

@@ -17,4 +27,5 @@ * Check if the given character contains an alpha character, a-z, A-Z, _

export function isAlpha(c) {
return /^[a-zA-Z_]$/.test(c);
return ALPHA_REGEX.test(c);
}
var ALPHA_REGEX = /^[a-zA-Z_]$/;
/**

@@ -27,4 +38,5 @@ * Check if the given character contains a hexadecimal character 0-9, a-f, A-F

export function isHex(c) {
return /^[0-9a-fA-F]$/.test(c);
return HEX_REGEX.test(c);
}
var HEX_REGEX = /^[0-9a-fA-F]$/;
/**

@@ -37,4 +49,5 @@ * checks if the given char c is a digit

export function isDigit(c) {
return c >= '0' && c <= '9';
return DIGIT_REGEX.test(c);
}
var DIGIT_REGEX = /^[0-9]$/;
/**

@@ -84,5 +97,25 @@ * Check if the given character is a whitespace character like space, tab, or

export function isQuote(c) {
return SINGLE_QUOTES.includes(c) || DOUBLE_QUOTES.includes(c);
return SINGLE_QUOTES[c] === true || DOUBLE_QUOTES[c] === true;
}
/**
* Test whether the given character is a single quote character.
* Also tests for special variants of single quotes.
* @param {string} c
* @returns {boolean}
*/
export function isSingleQuote(c) {
return SINGLE_QUOTES[c] === true;
}
/**
* Test whether the given character is a double quote character.
* Also tests for special variants of double quotes.
* @param {string} c
* @returns {boolean}
*/
export function isDoubleQuote(c) {
return DOUBLE_QUOTES[c] === true;
}
/**
* Normalize special double or single quote characters to their regular

@@ -95,7 +128,7 @@ * variant ' or "

export function normalizeQuote(c) {
if (SINGLE_QUOTES.includes(c)) {
if (SINGLE_QUOTES[c] === true) {
return '\'';
}
if (DOUBLE_QUOTES.includes(c)) {
if (DOUBLE_QUOTES[c] === true) {
return '"';

@@ -125,5 +158,14 @@ }

export function insertBeforeLastWhitespace(text, textToInsert) {
return text.replace(/\s*$/, function (match) {
return textToInsert + match;
});
var index = text.length;
if (!isWhitespace(text[index - 1])) {
// no trailing whitespaces
return text + textToInsert;
}
while (isWhitespace(text[index - 1])) {
index--;
}
return text.substring(0, index) + textToInsert + text.substring(index);
}

@@ -130,0 +172,0 @@ /**

@@ -19,11 +19,21 @@ (function (global, factory) {

var SINGLE_QUOTES = ['\'', // quote
"\u2018", // quote left
"\u2019", // quote right
"`", // grave accent
"\xB4" // acute accent
];
var DOUBLE_QUOTES = ['"', "\u201C", // double quote left
"\u201D" // double quote right
];
var SINGLE_QUOTES = {
'\'': true,
// quote
"\u2018": true,
// quote left
"\u2019": true,
// quote right
"`": true,
// grave accent
"\xB4": true // acute accent
};
var DOUBLE_QUOTES = {
'"': true,
"\u201C": true,
// double quote left
"\u201D": true // double quote right
};
/**

@@ -36,4 +46,5 @@ * Check if the given character contains an alpha character, a-z, A-Z, _

function isAlpha(c) {
return /^[a-zA-Z_]$/.test(c);
return ALPHA_REGEX.test(c);
}
var ALPHA_REGEX = /^[a-zA-Z_]$/;
/**

@@ -46,4 +57,5 @@ * Check if the given character contains a hexadecimal character 0-9, a-f, A-F

function isHex(c) {
return /^[0-9a-fA-F]$/.test(c);
return HEX_REGEX.test(c);
}
var HEX_REGEX = /^[0-9a-fA-F]$/;
/**

@@ -56,4 +68,5 @@ * checks if the given char c is a digit

function isDigit(c) {
return c >= '0' && c <= '9';
return DIGIT_REGEX.test(c);
}
var DIGIT_REGEX = /^[0-9]$/;
/**

@@ -103,5 +116,25 @@ * Check if the given character is a whitespace character like space, tab, or

function isQuote(c) {
return SINGLE_QUOTES.includes(c) || DOUBLE_QUOTES.includes(c);
return SINGLE_QUOTES[c] === true || DOUBLE_QUOTES[c] === true;
}
/**
* Test whether the given character is a single quote character.
* Also tests for special variants of single quotes.
* @param {string} c
* @returns {boolean}
*/
function isSingleQuote(c) {
return SINGLE_QUOTES[c] === true;
}
/**
* Test whether the given character is a double quote character.
* Also tests for special variants of double quotes.
* @param {string} c
* @returns {boolean}
*/
function isDoubleQuote(c) {
return DOUBLE_QUOTES[c] === true;
}
/**
* Normalize special double or single quote characters to their regular

@@ -114,7 +147,7 @@ * variant ' or "

function normalizeQuote(c) {
if (SINGLE_QUOTES.includes(c)) {
if (SINGLE_QUOTES[c] === true) {
return '\'';
}
if (DOUBLE_QUOTES.includes(c)) {
if (DOUBLE_QUOTES[c] === true) {
return '"';

@@ -144,5 +177,14 @@ }

function insertBeforeLastWhitespace(text, textToInsert) {
return text.replace(/\s*$/, function (match) {
return textToInsert + match;
});
var index = text.length;
if (!isWhitespace(text[index - 1])) {
// no trailing whitespaces
return text + textToInsert;
}
while (isWhitespace(text[index - 1])) {
index--;
}
return text.substring(0, index) + textToInsert + text.substring(index);
}

@@ -264,4 +306,8 @@ /**

// newline delimited JSON -> turn into a root level array
var stashedOutput = '';
while (tokenIsStartOfValue()) {
output = insertBeforeLastWhitespace(output, ','); // parse next newline delimited item
output = insertBeforeLastWhitespace(output, ',');
stashedOutput += output;
output = ''; // parse next newline delimited item

@@ -272,3 +318,3 @@ parseObject();

return "[\n".concat(output, "\n]");
return "[\n".concat(stashedOutput).concat(output, "\n]");
}

@@ -411,2 +457,3 @@

var quote = normalizeQuote(c);
var isEndQuote = isSingleQuote(c) ? isSingleQuote : isDoubleQuote;
token += '"'; // output valid double quote

@@ -417,3 +464,3 @@

while (c !== '' && normalizeQuote(c) !== quote) {
while (c !== '' && !isEndQuote(c)) {
if (c === '\\') {

@@ -420,0 +467,0 @@ // handle escape characters

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

!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e="undefined"!=typeof globalThis?globalThis:e||self).jsonrepair=n()}(this,function(){"use strict";function t(e,n){if(!(this instanceof t))throw new SyntaxError("Constructor must be called with the new operator");this.message=e+" (char "+n+")",this.char=n,this.stack=(new Error).stack}(t.prototype=new Error).constructor=Error;var r=["'","‘","’","`","´"],i=['"',"“","”"];function f(e){return/^[a-zA-Z_]$/.test(e)}function o(e){return"0"<=e&&e<="9"}function u(e){return" "===e||"\t"===e||"\n"===e||"\r"===e}function c(e){return" "===e||" "<=e&&e<=" "||" "===e||" "===e||" "===e}function s(e){return r.includes(e)?"'":i.includes(e)?'"':e}function e(e,n){n=e.lastIndexOf(n);return-1!==n?e.substring(0,n)+e.substring(n+1):e}function n(e,n){return e.replace(/\s*$/,function(e){return n+e})}var l=0,a=1,d=2,h=3,w=4,g=5,b=6,p={"":!0,"{":!0,"}":!0,"[":!0,"]":!0,":":!0,",":!0,"(":!0,")":!0,";":!0,"+":!0},v={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:"\n",r:"\r",t:"\t"},x={"\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t"},m={null:"null",true:"true",false:"false"},y={None:"null",True:"true",False:"false"},k="",I="",E=0,j="",A="",$=b;function O(){E++,j=k.charAt(E)}function T(){return $===l&&("["===A||"{"===A)||$===d||$===a||$===h}function C(){I+=A,$=b,A="",p[j]?($=l,A=j,O()):function(){if(o(j)||"-"===j){if($=a,"-"===j){if(A+=j,O(),!o(j))throw new t("Invalid number, digit expected",E)}else"0"===j&&(A+=j,O());for(;o(j);)A+=j,O();if("."===j){if(A+=j,O(),!o(j))throw new t("Invalid number, digit expected",E);for(;o(j);)A+=j,O()}if("e"===j||"E"===j){if(A+=j,O(),"+"!==j&&"-"!==j||(A+=j,O()),!o(j))throw new t("Invalid number, digit expected",E);for(;o(j);)A+=j,O()}}else!function(){if(function(e){return r.includes(e)||i.includes(e)}(j)){var e=s(j);for(A+='"',$=d,O();""!==j&&s(j)!==e;)if("\\"===j)if(O(),void 0!==v[j])A+="\\"+j,O();else if("u"===j){A+="\\u",O();for(var n=0;n<4;n++){if(!/^[0-9a-fA-F]$/.test(j))throw new t("Invalid unicode character",E-A.length);A+=j,O()}}else{if("'"!==j)throw new t('Invalid escape character "\\'+j+'"',E);A+="'",O()}else x[j]?A+=x[j]:A+='"'===j?'\\"':j,O();if(s(j)!==e)throw new t("End of string expected",E-A.length);return A+='"',O(),0}!function(){if(f(j))for($=h;f(j)||o(j)||"$"===j;)A+=j,O();else!function(){if(u(j)||c(j))for($=w;u(j)||c(j);)A+=j,O();else!function(){if("/"===j&&"*"===k[E+1]){for($=g;""!==j&&("*"!==j||"*"===j&&"/"!==k[E+1]);)A+=j,O();return"*"===j&&"/"===k[E+1]&&(A+=j,O(),A+=j,O())}if("/"!==j||"/"!==k[E+1])!function(){for($=b;""!==j;)A+=j,O();throw new t('Syntax error in part "'+A+'"',E-A.length)}();else for($=g;""!==j&&"\n"!==j;)A+=j,O()}()}()}()}()}(),$===w&&(A=function(e){for(var n="",t=0;t<e.length;t++){var r=e[t];n+=c(r)?" ":r}return n}(A),C()),$===g&&($=b,A="",C())}function F(){if($!==l||"{"!==A)!function(){if($===l&&"["===A){if(C(),$===l&&"]"===A)return C();for(;;)if(F(),$===l&&","===A){if(C(),$===l&&"]"===A){I=e(I,",");break}}else{if(!T())break;I=n(I,",")}return $===l&&"]"===A?C():I=n(I,"]")}!function(){if($!==d)!($===a?C():void function(){if($===h){if(m[A])return C();if(y[A])return A=y[A],C();var e=A,n=I.length;if(A="",C(),$===l&&"("===A)return A="",C(),F(),$===l&&")"===A&&(A="",C(),$===l&&";"===A&&(A="",C()));for(I=function(e,n,t){return e.substring(0,t)+n+e.substring(t)}(I,'"'.concat(e),n);$===h||$===a;)C();return I+='"'}!function(){throw new t(""===A?"Unexpected end of json string":"Value expected",E-A.length)}()}());else for(C();$===l&&"+"===A;){var e;A="",C(),$===d&&(e=I.lastIndexOf('"'),I=I.substring(0,e)+A.substring(1),A="",C())}}()}();else if(C(),$!==l||"}"!==A){for(;;){if($!==h&&$!==a||($=d,A='"'.concat(A,'"')),$!==d)throw new t("Object key expected",E-A.length);if(C(),$===l&&":"===A)C();else{if(!T())throw new t("Colon expected",E-A.length);I=n(I,":")}if(F(),$===l&&","===A){if(C(),$===l&&"}"===A){I=e(I,",");break}}else{if($!==d&&$!==a&&$!==h)break;I=n(I,",")}}$===l&&"}"===A?C():I=n(I,"}")}else C()}return function(e){if(I="",E=0,j=(k=e).charAt(0),A="",$=b,C(),e=$===l&&"{"===A,F(),""===A)return I;if(e&&T()){for(;T();)I=n(I,","),F();return"[\n".concat(I,"\n]")}throw new t("Unexpected characters",E-A.length)}});
!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(n="undefined"!=typeof globalThis?globalThis:n||self).jsonrepair=e()}(this,function(){"use strict";function t(n,e){if(!(this instanceof t))throw new SyntaxError("Constructor must be called with the new operator");this.message=n+" (char "+e+")",this.char=e,this.stack=(new Error).stack}(t.prototype=new Error).constructor=Error;var i={"'":!0,"‘":!0,"’":!0,"`":!0,"´":!0},f={'"':!0,"“":!0,"”":!0};function o(n){return e.test(n)}var e=/^[a-zA-Z_]$/;var u=/^[0-9a-fA-F]$/;function c(n){return r.test(n)}var r=/^[0-9]$/;function s(n){return" "===n||"\t"===n||"\n"===n||"\r"===n}function a(n){return" "===n||" "<=n&&n<=" "||" "===n||" "===n||" "===n}function l(n){return!0===i[n]}function h(n){return!0===f[n]}function d(n){return!0===i[n]?"'":!0===f[n]?'"':n}function n(n,e){e=n.lastIndexOf(e);return-1!==e?n.substring(0,e)+n.substring(e+1):n}function w(n,e){var r=n.length;if(!s(n[r-1]))return n+e;for(;s(n[r-1]);)r--;return n.substring(0,r)+e+n.substring(r)}var g=0,b=1,p=2,v=3,x=4,m=5,y=6,k={"":!0,"{":!0,"}":!0,"[":!0,"]":!0,":":!0,",":!0,"(":!0,")":!0,";":!0,"+":!0},I={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:"\n",r:"\r",t:"\t"},E={"\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t"},j={null:"null",true:"true",false:"false"},A={None:"null",True:"true",False:"false"},$="",O="",T=0,C="",F="",S=y;function U(){T++,C=$.charAt(T)}function z(){return S===g&&("["===F||"{"===F)||S===p||S===b||S===v}function N(){O+=F,S=y,F="",k[C]?(S=g,F=C,U()):function(){if(c(C)||"-"===C){if(S=b,"-"===C){if(F+=C,U(),!c(C))throw new t("Invalid number, digit expected",T)}else"0"===C&&(F+=C,U());for(;c(C);)F+=C,U();if("."===C){if(F+=C,U(),!c(C))throw new t("Invalid number, digit expected",T);for(;c(C);)F+=C,U()}if("e"===C||"E"===C){if(F+=C,U(),"+"!==C&&"-"!==C||(F+=C,U()),!c(C))throw new t("Invalid number, digit expected",T);for(;c(C);)F+=C,U()}}else!function(){if(function(n){return!0===i[n]||!0===f[n]}(C)){var n=d(C),e=l(C)?l:h;for(F+='"',S=p,U();""!==C&&!e(C);)if("\\"===C)if(U(),void 0!==I[C])F+="\\"+C,U();else if("u"===C){F+="\\u",U();for(var r=0;r<4;r++){if(!function(n){return u.test(n)}(C))throw new t("Invalid unicode character",T-F.length);F+=C,U()}}else{if("'"!==C)throw new t('Invalid escape character "\\'+C+'"',T);F+="'",U()}else E[C]?F+=E[C]:F+='"'===C?'\\"':C,U();if(d(C)!==n)throw new t("End of string expected",T-F.length);return F+='"',U(),0}!function(){if(o(C))for(S=v;o(C)||c(C)||"$"===C;)F+=C,U();else!function(){if(s(C)||a(C))for(S=x;s(C)||a(C);)F+=C,U();else!function(){if("/"===C&&"*"===$[T+1]){for(S=m;""!==C&&("*"!==C||"*"===C&&"/"!==$[T+1]);)F+=C,U();return"*"===C&&"/"===$[T+1]&&(F+=C,U(),F+=C,U())}if("/"!==C||"/"!==$[T+1])!function(){for(S=y;""!==C;)F+=C,U();throw new t('Syntax error in part "'+F+'"',T-F.length)}();else for(S=m;""!==C&&"\n"!==C;)F+=C,U()}()}()}()}()}(),S===x&&(F=function(n){for(var e="",r=0;r<n.length;r++){var t=n[r];e+=a(t)?" ":t}return e}(F),N()),S===m&&(S=y,F="",N())}function V(){if(S!==g||"{"!==F)!function(){if(S===g&&"["===F){if(N(),S===g&&"]"===F)return N();for(;;)if(V(),S===g&&","===F){if(N(),S===g&&"]"===F){O=n(O,",");break}}else{if(!z())break;O=w(O,",")}return S===g&&"]"===F?N():O=w(O,"]")}!function(){if(S!==p)!(S===b?N():void function(){if(S===v){if(j[F])return N();if(A[F])return F=A[F],N();var n=F,e=O.length;if(F="",N(),S===g&&"("===F)return F="",N(),V(),S===g&&")"===F&&(F="",N(),S===g&&";"===F&&(F="",N()));for(O=function(n,e,r){return n.substring(0,r)+e+n.substring(r)}(O,'"'.concat(n),e);S===v||S===b;)N();return O+='"'}!function(){throw new t(""===F?"Unexpected end of json string":"Value expected",T-F.length)}()}());else for(N();S===g&&"+"===F;){var n;F="",N(),S===p&&(n=O.lastIndexOf('"'),O=O.substring(0,n)+F.substring(1),F="",N())}}()}();else if(N(),S!==g||"}"!==F){for(;;){if(S!==v&&S!==b||(S=p,F='"'.concat(F,'"')),S!==p)throw new t("Object key expected",T-F.length);if(N(),S===g&&":"===F)N();else{if(!z())throw new t("Colon expected",T-F.length);O=w(O,":")}if(V(),S===g&&","===F){if(N(),S===g&&"}"===F){O=n(O,",");break}}else{if(S!==p&&S!==b&&S!==v)break;O=w(O,",")}}S===g&&"}"===F?N():O=w(O,"}")}else N()}return function(n){if(O="",T=0,C=($=n).charAt(0),F="",S=y,N(),n=S===g&&"{"===F,V(),""===F)return O;if(n&&z()){for(var e="";z();)e+=O=w(O,","),O="",V();return"[\n".concat(e).concat(O,"\n]")}throw new t("Unexpected characters",T-F.length)}});
{
"name": "jsonrepair",
"version": "2.0.0",
"version": "2.0.1",
"description": "Repair broken JSON documents",

@@ -44,16 +44,16 @@ "repository": {

"devDependencies": {
"@babel/cli": "7.12.10",
"@babel/core": "7.12.10",
"@babel/preset-env": "7.12.11",
"@babel/cli": "7.12.16",
"@babel/core": "7.12.16",
"@babel/preset-env": "7.12.16",
"cpy-cli": "3.1.1",
"del-cli": "3.0.1",
"eslint": "7.17.0",
"eslint": "7.20.0",
"eslint-config-standard": "16.0.2",
"eslint-plugin-import": "2.22.1",
"eslint-plugin-node": "11.1.0",
"eslint-plugin-promise": "4.2.1",
"mocha": "8.2.1",
"rollup": "2.36.1",
"uglify-js": "3.12.4"
"eslint-plugin-promise": "4.3.1",
"mocha": "8.3.0",
"rollup": "2.39.0",
"uglify-js": "3.12.8"
}
}

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

Sorry, the diff of this file is not supported yet

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