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 3.9.0 to 3.10.0

17

lib/cjs/regular/jsonrepair.js

@@ -401,2 +401,10 @@ "use strict";

// test start of an url like "https://..." (this would be parsed as a comment)
if (text.charCodeAt(i - 1) === _stringUtils.codeColon && _stringUtils.regexUrlStart.test(text.substring(iBefore + 1, i + 2))) {
while (i < text.length && _stringUtils.regexUrlChar.test(text[i])) {
str += text[i];
i++;
}
}
// repair missing quote

@@ -611,5 +619,12 @@ str = (0, _stringUtils.insertBeforeLastWhitespace)(str, '"');

}
while (i < text.length && !(0, _stringUtils.isUnquotedStringDelimiter)(text[i]) && !(0, _stringUtils.isQuote)(text.charCodeAt(i)) && (!isKey || text[i] !== ':')) {
while (i < text.length && !(0, _stringUtils.isUnquotedStringDelimiter)(text[i]) && !(0, _stringUtils.isQuote)(text.charCodeAt(i)) && (!isKey || text.charCodeAt(i) !== _stringUtils.codeColon)) {
i++;
}
// test start of an url like "https://..." (this would be parsed as a comment)
if (text.charCodeAt(i - 1) === _stringUtils.codeColon && _stringUtils.regexUrlStart.test(text.substring(start, i + 2))) {
while (i < text.length && _stringUtils.regexUrlChar.test(text[i])) {
i++;
}
}
if (i > start) {

@@ -616,0 +631,0 @@ // repair unquoted string

24

lib/cjs/streaming/core.js

@@ -180,6 +180,12 @@ "use strict";

}
const unquotedStringEnd = findNextDelimiter(false, j);
if (unquotedStringEnd !== null) {
const symbol = input.substring(i, unquotedStringEnd);
i = unquotedStringEnd;
j = findNextDelimiter(false, j);
if (j !== null) {
// test start of an url like "https://..." (this would be parsed as a comment)
if (input.charCodeAt(j - 1) === _stringUtils.codeColon && _stringUtils.regexUrlStart.test(input.substring(i, j + 2))) {
while (!input.isEnd(j) && _stringUtils.regexUrlChar.test(input.charAt(j))) {
j++;
}
}
const symbol = input.substring(i, j);
i = j;
output.push(symbol === 'undefined' ? 'null' : JSON.stringify(symbol));

@@ -517,2 +523,10 @@ if (input.charCodeAt(i) === _stringUtils.codeDoubleQuote) {

// test start of an url like "https://..." (this would be parsed as a comment)
if (input.charCodeAt(i - 1) === _stringUtils.codeColon && _stringUtils.regexUrlStart.test(input.substring(iBefore + 1, i + 2))) {
while (!input.isEnd(i) && _stringUtils.regexUrlChar.test(input.charAt(i))) {
output.push(input.charAt(i));
i++;
}
}
// repair missing quote

@@ -714,3 +728,3 @@ output.insertBeforeLastWhitespace('"');

let j = start;
while (!input.isEnd(j) && !(0, _stringUtils.isUnquotedStringDelimiter)(input.charAt(j)) && !(0, _stringUtils.isQuote)(input.charCodeAt(j)) && (!isKey || input.charAt(j) !== ':')) {
while (!input.isEnd(j) && !(0, _stringUtils.isUnquotedStringDelimiter)(input.charAt(j)) && !(0, _stringUtils.isQuote)(input.charCodeAt(j)) && (!isKey || input.charCodeAt(j) !== _stringUtils.codeColon)) {
j++;

@@ -717,0 +731,0 @@ }

@@ -23,3 +23,3 @@ "use strict";

exports.isWhitespace = isWhitespace;
exports.regexFunctionNameCharStart = exports.regexFunctionNameChar = void 0;
exports.regexUrlStart = exports.regexUrlChar = exports.regexFunctionNameCharStart = exports.regexFunctionNameChar = void 0;
exports.removeAtIndex = removeAtIndex;

@@ -87,2 +87,8 @@ exports.stripLastOccurrence = stripLastOccurrence;

const regexFunctionNameChar = exports.regexFunctionNameChar = /^[a-zA-Z_$0-9]$/;
// matches "https://" and other schemas
const regexUrlStart = exports.regexUrlStart = /^(http|https|ftp|mailto|file|data|irc):\/\/$/;
// matches all valid URL characters EXCEPT "[", "]", and ",", since that are important JSON delimiters
const regexUrlChar = exports.regexUrlChar = /^[A-Za-z0-9-._~:/?#@!$&'()*+;=]$/;
function isUnquotedStringDelimiter(char) {

@@ -89,0 +95,0 @@ return regexUnquotedStringDelimiter.test(char);

import { JSONRepairError } from '../utils/JSONRepairError.js';
import { codeAsterisk, codeBackslash, codeCloseParenthesis, codeClosingBrace, codeClosingBracket, codeColon, codeComma, codeDot, codeDoubleQuote, codeLowercaseE, codeMinus, codeNewline, codeOpeningBrace, codeOpeningBracket, codePlus, codeSemicolon, codeSlash, codeUppercaseE, endsWithCommaOrNewline, insertBeforeLastWhitespace, isControlCharacter, isDelimiter, isDigit, isDoubleQuote, isDoubleQuoteLike, isHex, isQuote, isSingleQuote, isSingleQuoteLike, isSpecialWhitespace, isStartOfValue, isUnquotedStringDelimiter, isValidStringCharacter, isWhitespace, regexFunctionNameChar, regexFunctionNameCharStart, removeAtIndex, stripLastOccurrence } from '../utils/stringUtils.js';
import { codeAsterisk, codeBackslash, codeCloseParenthesis, codeClosingBrace, codeClosingBracket, codeColon, codeComma, codeDot, codeDoubleQuote, codeLowercaseE, codeMinus, codeNewline, codeOpeningBrace, codeOpeningBracket, codePlus, codeSemicolon, codeSlash, codeUppercaseE, endsWithCommaOrNewline, insertBeforeLastWhitespace, isControlCharacter, isDelimiter, isDigit, isDoubleQuote, isDoubleQuoteLike, isHex, isQuote, isSingleQuote, isSingleQuoteLike, isSpecialWhitespace, isStartOfValue, isUnquotedStringDelimiter, isValidStringCharacter, isWhitespace, regexFunctionNameChar, regexFunctionNameCharStart, regexUrlChar, regexUrlStart, removeAtIndex, stripLastOccurrence } from '../utils/stringUtils.js';
const controlCharacters = {

@@ -395,2 +395,10 @@ '\b': '\\b',

// test start of an url like "https://..." (this would be parsed as a comment)
if (text.charCodeAt(i - 1) === codeColon && regexUrlStart.test(text.substring(iBefore + 1, i + 2))) {
while (i < text.length && regexUrlChar.test(text[i])) {
str += text[i];
i++;
}
}
// repair missing quote

@@ -605,5 +613,12 @@ str = insertBeforeLastWhitespace(str, '"');

}
while (i < text.length && !isUnquotedStringDelimiter(text[i]) && !isQuote(text.charCodeAt(i)) && (!isKey || text[i] !== ':')) {
while (i < text.length && !isUnquotedStringDelimiter(text[i]) && !isQuote(text.charCodeAt(i)) && (!isKey || text.charCodeAt(i) !== codeColon)) {
i++;
}
// test start of an url like "https://..." (this would be parsed as a comment)
if (text.charCodeAt(i - 1) === codeColon && regexUrlStart.test(text.substring(start, i + 2))) {
while (i < text.length && regexUrlChar.test(text[i])) {
i++;
}
}
if (i > start) {

@@ -610,0 +625,0 @@ // repair unquoted string

import { JSONRepairError } from '../utils/JSONRepairError.js';
import { codeAsterisk, codeBackslash, codeCloseParenthesis, codeClosingBrace, codeClosingBracket, codeColon, codeComma, codeDot, codeDoubleQuote, codeLowercaseE, codeMinus, codeNewline, codeOpenParenthesis, codeOpeningBrace, codeOpeningBracket, codePlus, codeSemicolon, codeSlash, codeUppercaseE, isControlCharacter, isDelimiter, isDigit, isDoubleQuote, isDoubleQuoteLike, isHex, isQuote, isSingleQuote, isSingleQuoteLike, isSpecialWhitespace, isStartOfValue, isUnquotedStringDelimiter, isValidStringCharacter, isWhitespace, regexFunctionNameChar, regexFunctionNameCharStart } from '../utils/stringUtils.js';
import { codeAsterisk, codeBackslash, codeCloseParenthesis, codeClosingBrace, codeClosingBracket, codeColon, codeComma, codeDot, codeDoubleQuote, codeLowercaseE, codeMinus, codeNewline, codeOpenParenthesis, codeOpeningBrace, codeOpeningBracket, codePlus, codeSemicolon, codeSlash, codeUppercaseE, isControlCharacter, isDelimiter, isDigit, isDoubleQuote, isDoubleQuoteLike, isHex, isQuote, isSingleQuote, isSingleQuoteLike, isSpecialWhitespace, isStartOfValue, isUnquotedStringDelimiter, isValidStringCharacter, isWhitespace, regexFunctionNameChar, regexFunctionNameCharStart, regexUrlChar, regexUrlStart } from '../utils/stringUtils.js';
import { createInputBuffer } from './buffer/InputBuffer.js';

@@ -174,6 +174,12 @@ import { createOutputBuffer } from './buffer/OutputBuffer.js';

}
const unquotedStringEnd = findNextDelimiter(false, j);
if (unquotedStringEnd !== null) {
const symbol = input.substring(i, unquotedStringEnd);
i = unquotedStringEnd;
j = findNextDelimiter(false, j);
if (j !== null) {
// test start of an url like "https://..." (this would be parsed as a comment)
if (input.charCodeAt(j - 1) === codeColon && regexUrlStart.test(input.substring(i, j + 2))) {
while (!input.isEnd(j) && regexUrlChar.test(input.charAt(j))) {
j++;
}
}
const symbol = input.substring(i, j);
i = j;
output.push(symbol === 'undefined' ? 'null' : JSON.stringify(symbol));

@@ -511,2 +517,10 @@ if (input.charCodeAt(i) === codeDoubleQuote) {

// test start of an url like "https://..." (this would be parsed as a comment)
if (input.charCodeAt(i - 1) === codeColon && regexUrlStart.test(input.substring(iBefore + 1, i + 2))) {
while (!input.isEnd(i) && regexUrlChar.test(input.charAt(i))) {
output.push(input.charAt(i));
i++;
}
}
// repair missing quote

@@ -708,3 +722,3 @@ output.insertBeforeLastWhitespace('"');

let j = start;
while (!input.isEnd(j) && !isUnquotedStringDelimiter(input.charAt(j)) && !isQuote(input.charCodeAt(j)) && (!isKey || input.charAt(j) !== ':')) {
while (!input.isEnd(j) && !isUnquotedStringDelimiter(input.charAt(j)) && !isQuote(input.charCodeAt(j)) && (!isKey || input.charCodeAt(j) !== codeColon)) {
j++;

@@ -711,0 +725,0 @@ }

@@ -61,2 +61,8 @@ export const codeBackslash = 0x5c; // "\"

export const regexFunctionNameChar = /^[a-zA-Z_$0-9]$/;
// matches "https://" and other schemas
export const regexUrlStart = /^(http|https|ftp|mailto|file|data|irc):\/\/$/;
// matches all valid URL characters EXCEPT "[", "]", and ",", since that are important JSON delimiters
export const regexUrlChar = /^[A-Za-z0-9-._~:/?#@!$&'()*+;=]$/;
export function isUnquotedStringDelimiter(char) {

@@ -63,0 +69,0 @@ return regexUnquotedStringDelimiter.test(char);

@@ -38,2 +38,4 @@ export declare const codeBackslash = 92;

export declare const regexFunctionNameChar: RegExp;
export declare const regexUrlStart: RegExp;
export declare const regexUrlChar: RegExp;
export declare function isUnquotedStringDelimiter(char: string): boolean;

@@ -40,0 +42,0 @@ export declare function isStartOfValue(char: string): boolean;

@@ -73,2 +73,8 @@ (function (global, factory) {

const regexFunctionNameChar = /^[a-zA-Z_$0-9]$/;
// matches "https://" and other schemas
const regexUrlStart = /^(http|https|ftp|mailto|file|data|irc):\/\/$/;
// matches all valid URL characters EXCEPT "[", "]", and ",", since that are important JSON delimiters
const regexUrlChar = /^[A-Za-z0-9-._~:/?#@!$&'()*+;=]$/;
function isUnquotedStringDelimiter(char) {

@@ -567,2 +573,10 @@ return regexUnquotedStringDelimiter.test(char);

// test start of an url like "https://..." (this would be parsed as a comment)
if (text.charCodeAt(i - 1) === codeColon && regexUrlStart.test(text.substring(iBefore + 1, i + 2))) {
while (i < text.length && regexUrlChar.test(text[i])) {
str += text[i];
i++;
}
}
// repair missing quote

@@ -777,5 +791,12 @@ str = insertBeforeLastWhitespace(str, '"');

}
while (i < text.length && !isUnquotedStringDelimiter(text[i]) && !isQuote(text.charCodeAt(i)) && (!isKey || text[i] !== ':')) {
while (i < text.length && !isUnquotedStringDelimiter(text[i]) && !isQuote(text.charCodeAt(i)) && (!isKey || text.charCodeAt(i) !== codeColon)) {
i++;
}
// test start of an url like "https://..." (this would be parsed as a comment)
if (text.charCodeAt(i - 1) === codeColon && regexUrlStart.test(text.substring(start, i + 2))) {
while (i < text.length && regexUrlChar.test(text[i])) {
i++;
}
}
if (i > start) {

@@ -782,0 +803,0 @@ // repair unquoted string

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

((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){class $ extends Error{constructor(t,e){super(t+" at position "+e),this.position=e}}let u=125,e=32,x=10,y=9,O=13,N=8,J=12,S=34,r=39,j=48,k=57,d=44,I=65,T=97,m=70,z=102,l=160,E=8192,R=8202,U=8239,Z=8287,_=12288,n=8220,o=8221,i=8216,c=8217,f=96,a=180;function F(t){return t>=j&&t<=k}function q(t){return h.test(t)}let h=/^[,:[\]/{}()\n+]$/,s=/^[,[\]/{}\n+]$/,W=/^[a-zA-Z_$]$/,X=/^[a-zA-Z_$0-9]$/;function B(t){return s.test(t)}function D(t){return A.test(t)||t&&H(t.charCodeAt(0))}let A=/^[[{\w-]$/;function G(t){return t===e||t===x||t===y||t===O}function H(t){return K(t)||M(t)}function K(t){return t===S||t===n||t===o}function L(t){return t===S}function M(t){return t===r||t===i||t===c||t===f||t===a}function P(t){return t===r}function Q(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 V(t,e){let r=t.length;if(!G(t.charCodeAt(r-1)))return t+e;for(;G(t.charCodeAt(r-1));)r--;return t.substring(0,r)+e+t.substring(r)}let Y={"\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t"},tt={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:"\n",r:"\r",t:"\t"};t.JSONRepairError=$,t.jsonrepair=function(s){let A=0,C="";if(!i())throw new $("Unexpected end of json string",s.length);var t=c(d);if(t&&g(),D(s[A])&&/[,\n][ \t\r]*$/.test(C)){t||(C=V(C,","));{let t=!0,e=!0;for(;e;)t?t=!1:c(d)||(C=V(C,",")),e=i();C=`[
((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){class w extends Error{constructor(t,e){super(t+" at position "+e),this.position=e}}let u=125,e=32,x=10,y=9,O=13,N=8,J=12,S=34,r=39,j=48,k=57,d=44,m=65,z=97,I=70,T=102,l=160,Z=8192,_=8202,E=8239,W=8287,X=12288,n=8220,o=8221,i=8216,c=8217,f=96,a=180;function R(t){return t>=j&&t<=k}function U(t){return h.test(t)}let h=/^[,:[\]/{}()\n+]$/,s=/^[,[\]/{}\n+]$/,Y=/^[a-zA-Z_$]$/,tt=/^[a-zA-Z_$0-9]$/,F=/^(http|https|ftp|mailto|file|data|irc):\/\/$/,q=/^[A-Za-z0-9-._~:/?#@!$&'()*+;=]$/;function B(t){return s.test(t)}function D(t){return A.test(t)||t&&H(t.charCodeAt(0))}let A=/^[[{\w-]$/;function G(t){return t===e||t===x||t===y||t===O}function H(t){return K(t)||M(t)}function K(t){return t===S||t===n||t===o}function L(t){return t===S}function M(t){return t===r||t===i||t===c||t===f||t===a}function P(t){return t===r}function Q(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 V(t,e){let r=t.length;if(!G(t.charCodeAt(r-1)))return t+e;for(;G(t.charCodeAt(r-1));)r--;return t.substring(0,r)+e+t.substring(r)}let et={"\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t"},rt={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:"\n",r:"\r",t:"\t"};t.JSONRepairError=w,t.jsonrepair=function(s){let A=0,C="";if(!i())throw new w("Unexpected end of json string",s.length);var t=c(d);if(t&&g(),D(s[A])&&/[,\n][ \t\r]*$/.test(C)){t||(C=V(C,","));{let t=!0,e=!0;for(;e;)t?t=!1:c(d)||(C=V(C,",")),e=i();C=`[
${C=e?C:Q(C,",")}
]`}}else t&&(C=Q(C,","));for(;s.charCodeAt(A)===u||93===s.charCodeAt(A);)A++,g();if(A>=s.length)return C;throw new $("Unexpected character "+JSON.stringify(s[A]),A);function i(){g();var t=(()=>{if(123!==s.charCodeAt(A))return!1;{C+="{",A++,g(),b(d)&&g();let e=!0;for(;A<s.length&&s.charCodeAt(A)!==u;){let t;if(e?(t=!0,e=!1):((t=c(d))||(C=V(C,",")),g()),f(),!(v()||a(!0))){s.charCodeAt(A)===u||123===s.charCodeAt(A)||93===s.charCodeAt(A)||91===s.charCodeAt(A)||void 0===s[A]?C=Q(C,","):(()=>{throw new $("Object key expected",A)})();break}g();var r=c(58),n=A>=s.length,o=(r||(D(s[A])||n?C=V(C,":"):h()),i());o||(r||n?C+="null":h())}return s.charCodeAt(A)===u?(C+="}",A++):C=V(C,"}"),!0}})()||(()=>{if(91!==s.charCodeAt(A))return!1;{C+="[",A++,g(),b(d)&&g();let t=!0;for(;A<s.length&&93!==s.charCodeAt(A);){t?t=!1:c(d)||(C=V(C,",")),f();var e=i();if(!e){C=Q(C,",");break}}return 93===s.charCodeAt(A)?(C+="]",A++):C=V(C,"]"),!0}})()||v()||(()=>{var t,e,r=A;if(45===s.charCodeAt(A)){if(A++,n())return o(r),!0;if(!F(s.charCodeAt(A)))return A=r,!1}for(;F(s.charCodeAt(A));)A++;if(46===s.charCodeAt(A)){if(A++,n())return o(r),!0;if(!F(s.charCodeAt(A)))return A=r,!1;for(;F(s.charCodeAt(A));)A++}if(101===s.charCodeAt(A)||69===s.charCodeAt(A)){if(A++,45!==s.charCodeAt(A)&&43!==s.charCodeAt(A)||A++,n())return o(r),!0;if(!F(s.charCodeAt(A)))return A=r,!1;for(;F(s.charCodeAt(A));)A++}if(n()){if(A>r)return t=s.slice(r,A),e=/^0\d/.test(t),C+=e?`"${t}"`:t,!0}else A=r;return!1})()||r("true","true")||r("false","false")||r("null","null")||r("True","true")||r("False","false")||r("None","null")||a(!1)||(()=>{if("/"===s[A]){var t=A;for(A++;A<s.length&&("/"!==s[A]||"\\"===s[A-1]);)A++;return A++,C+=`"${s.substring(t,A)}"`,!0}})();return g(),t}function g(){A;let t=e();for(;t=(t=(()=>{if(47===s.charCodeAt(A)&&42===s.charCodeAt(A+1)){for(;A<s.length&&!((t,e)=>"*"===t[e]&&"/"===t[e+1])(s,A);)A++;A+=2}else{if(47!==s.charCodeAt(A)||47!==s.charCodeAt(A+1))return!1;for(;A<s.length&&s.charCodeAt(A)!==x;)A++}return!0})())&&e(););A}function e(){let t="";for(var e,r;(e=G(s.charCodeAt(A)))||(r=s.charCodeAt(A))===l||r>=E&&r<=R||r===U||r===Z||r===_;)t+=e?s[A]:" ",A++;return 0<t.length&&(C+=t,!0)}function c(t){return s.charCodeAt(A)===t&&(C+=s[A],A++,!0)}function b(t){return s.charCodeAt(A)===t&&(A++,!0)}function f(){g(),46===s.charCodeAt(A)&&46===s.charCodeAt(A+1)&&46===s.charCodeAt(A+2)&&(A+=3,g(),b(d))}function v(t){var r,n,o=0<arguments.length&&void 0!==t&&t;let i=92===s.charCodeAt(A);if(i&&(A++,i=!0),H(s.charCodeAt(A))){var c=L(s.charCodeAt(A))?L:P(s.charCodeAt(A))?P:M(s.charCodeAt(A))?M:K,f=A,a=C.length;let e='"';for(A++;;){if(A>=s.length)return h=w(A-1),!o&&q(s.charAt(h))?(A=f,C=C.substring(0,a),v(!0)):(e=V(e,'"'),C+=e,!0);if(c(s.charCodeAt(A))){var h=A,u=e.length;if(e+='"',A++,C+=e,g(),o||A>=s.length||q(s.charAt(A))||H(s.charCodeAt(A))||F(s.charCodeAt(A)))return p(),!0;if(q(s.charAt(w(h-1))))return A=f,C=C.substring(0,a),v(!0);C=C.substring(0,a),A=h+1,e=e.substring(0,u)+"\\"+e.substring(u)}else{if(o&&B(s[A]))return e=V(e,'"'),C+=e,p(),!0;if(92===s.charCodeAt(A)){u=s.charAt(A+1);if(void 0!==tt[u])e+=s.slice(A,A+2),A+=2;else if("u"===u){let t=2;for(;t<6&&((n=s.charCodeAt(A+t))>=j&&n<=k||n>=I&&n<=m||n>=T&&n<=z);)t++;if(6===t)e+=s.slice(A,A+6),A+=6;else{if(!(A+t>=s.length))throw d=void 0,d=s.slice(A,A+6),new $(`Invalid unicode character "${d}"`,A);A=s.length}}else e+=u,A+=2}else{var d=s.charAt(A),l=s.charCodeAt(A);if(l===S&&92!==s.charCodeAt(A-1))e+="\\"+d;else if((r=l)===x||r===O||r===y||r===N||r===J)e+=Y[d];else{if(!(32<=(r=l)&&r<=1114111))throw l=void 0,l=d,new $("Invalid character "+JSON.stringify(l),A);e+=d}A++}}i&&b(92)}}return!1}function p(){let t=!1;for(g();43===s.charCodeAt(A);){t=!0,A++,g();var e=(C=Q(C,'"',!0)).length,r=v();C=r?(r=C,e=e,n=1,r.substring(0,e)+r.substring(e+n)):V(C,'"')}var n;t}function r(t,e){return s.slice(A,A+t.length)===t&&(C+=e,A+=t.length,!0)}function a(t){var e=A;if(W.test(s[A])){for(;A<s.length&&X.test(s[A]);)A++;let t=A;for(;G(s.charCodeAt(t));)t++;if("("===s[t])return A=t+1,i(),41===s.charCodeAt(A)&&(A++,59===s.charCodeAt(A))&&A++,!0}for(;A<s.length&&!B(s[A])&&!H(s.charCodeAt(A))&&(!t||":"!==s[A]);)A++;if(A>e){for(;G(s.charCodeAt(A-1))&&0<A;)A--;e=s.slice(e,A);return C+="undefined"===e?"null":JSON.stringify(e),s.charCodeAt(A)===S&&A++,!0}}function w(t){let e=t;for(;0<e&&G(s.charCodeAt(e));)e--;return e}function n(){return A>=s.length||q(s[A])||G(s.charCodeAt(A))}function o(t){C+=s.slice(t,A)+"0"}function h(){throw new $("Colon expected",A)}}});
]`}}else t&&(C=Q(C,","));for(;s.charCodeAt(A)===u||93===s.charCodeAt(A);)A++,g();if(A>=s.length)return C;throw new w("Unexpected character "+JSON.stringify(s[A]),A);function i(){g();var t=(()=>{if(123!==s.charCodeAt(A))return!1;{C+="{",A++,g(),b(d)&&g();let e=!0;for(;A<s.length&&s.charCodeAt(A)!==u;){let t;if(e?(t=!0,e=!1):((t=c(d))||(C=V(C,",")),g()),f(),!(v()||a(!0))){s.charCodeAt(A)===u||123===s.charCodeAt(A)||93===s.charCodeAt(A)||91===s.charCodeAt(A)||void 0===s[A]?C=Q(C,","):(()=>{throw new w("Object key expected",A)})();break}g();var r=c(58),n=A>=s.length,o=(r||(D(s[A])||n?C=V(C,":"):h()),i());o||(r||n?C+="null":h())}return s.charCodeAt(A)===u?(C+="}",A++):C=V(C,"}"),!0}})()||(()=>{if(91!==s.charCodeAt(A))return!1;{C+="[",A++,g(),b(d)&&g();let t=!0;for(;A<s.length&&93!==s.charCodeAt(A);){t?t=!1:c(d)||(C=V(C,",")),f();var e=i();if(!e){C=Q(C,",");break}}return 93===s.charCodeAt(A)?(C+="]",A++):C=V(C,"]"),!0}})()||v()||(()=>{var t,e,r=A;if(45===s.charCodeAt(A)){if(A++,n())return o(r),!0;if(!R(s.charCodeAt(A)))return A=r,!1}for(;R(s.charCodeAt(A));)A++;if(46===s.charCodeAt(A)){if(A++,n())return o(r),!0;if(!R(s.charCodeAt(A)))return A=r,!1;for(;R(s.charCodeAt(A));)A++}if(101===s.charCodeAt(A)||69===s.charCodeAt(A)){if(A++,45!==s.charCodeAt(A)&&43!==s.charCodeAt(A)||A++,n())return o(r),!0;if(!R(s.charCodeAt(A)))return A=r,!1;for(;R(s.charCodeAt(A));)A++}if(n()){if(A>r)return t=s.slice(r,A),e=/^0\d/.test(t),C+=e?`"${t}"`:t,!0}else A=r;return!1})()||r("true","true")||r("false","false")||r("null","null")||r("True","true")||r("False","false")||r("None","null")||a(!1)||(()=>{if("/"===s[A]){var t=A;for(A++;A<s.length&&("/"!==s[A]||"\\"===s[A-1]);)A++;return A++,C+=`"${s.substring(t,A)}"`,!0}})();return g(),t}function g(){A;let t=e();for(;t=(t=(()=>{if(47===s.charCodeAt(A)&&42===s.charCodeAt(A+1)){for(;A<s.length&&!((t,e)=>"*"===t[e]&&"/"===t[e+1])(s,A);)A++;A+=2}else{if(47!==s.charCodeAt(A)||47!==s.charCodeAt(A+1))return!1;for(;A<s.length&&s.charCodeAt(A)!==x;)A++}return!0})())&&e(););A}function e(){let t="";for(var e,r;(e=G(s.charCodeAt(A)))||(r=s.charCodeAt(A))===l||r>=Z&&r<=_||r===E||r===W||r===X;)t+=e?s[A]:" ",A++;return 0<t.length&&(C+=t,!0)}function c(t){return s.charCodeAt(A)===t&&(C+=s[A],A++,!0)}function b(t){return s.charCodeAt(A)===t&&(A++,!0)}function f(){g(),46===s.charCodeAt(A)&&46===s.charCodeAt(A+1)&&46===s.charCodeAt(A+2)&&(A+=3,g(),b(d))}function v(t){var r,n,o=0<arguments.length&&void 0!==t&&t;let i=92===s.charCodeAt(A);if(i&&(A++,i=!0),H(s.charCodeAt(A))){var c=L(s.charCodeAt(A))?L:P(s.charCodeAt(A))?P:M(s.charCodeAt(A))?M:K,f=A,a=C.length;let e='"';for(A++;;){if(A>=s.length)return h=$(A-1),!o&&U(s.charAt(h))?(A=f,C=C.substring(0,a),v(!0)):(e=V(e,'"'),C+=e,!0);if(c(s.charCodeAt(A))){var h=A,u=e.length;if(e+='"',A++,C+=e,g(),o||A>=s.length||U(s.charAt(A))||H(s.charCodeAt(A))||R(s.charCodeAt(A)))return p(),!0;if(U(s.charAt($(h-1))))return A=f,C=C.substring(0,a),v(!0);C=C.substring(0,a),A=h+1,e=e.substring(0,u)+"\\"+e.substring(u)}else{if(o&&B(s[A])){if(58===s.charCodeAt(A-1)&&F.test(s.substring(f+1,A+2)))for(;A<s.length&&q.test(s[A]);)e+=s[A],A++;return e=V(e,'"'),C+=e,p(),!0}if(92===s.charCodeAt(A)){u=s.charAt(A+1);if(void 0!==rt[u])e+=s.slice(A,A+2),A+=2;else if("u"===u){let t=2;for(;t<6&&((n=s.charCodeAt(A+t))>=j&&n<=k||n>=m&&n<=I||n>=z&&n<=T);)t++;if(6===t)e+=s.slice(A,A+6),A+=6;else{if(!(A+t>=s.length))throw d=void 0,d=s.slice(A,A+6),new w(`Invalid unicode character "${d}"`,A);A=s.length}}else e+=u,A+=2}else{var d=s.charAt(A),l=s.charCodeAt(A);if(l===S&&92!==s.charCodeAt(A-1))e+="\\"+d;else if((r=l)===x||r===O||r===y||r===N||r===J)e+=et[d];else{if(!(32<=(r=l)&&r<=1114111))throw l=void 0,l=d,new w("Invalid character "+JSON.stringify(l),A);e+=d}A++}}i&&b(92)}}return!1}function p(){let t=!1;for(g();43===s.charCodeAt(A);){t=!0,A++,g();var e=(C=Q(C,'"',!0)).length,r=v();C=r?(r=C,e=e,n=1,r.substring(0,e)+r.substring(e+n)):V(C,'"')}var n;t}function r(t,e){return s.slice(A,A+t.length)===t&&(C+=e,A+=t.length,!0)}function a(t){var e=A;if(Y.test(s[A])){for(;A<s.length&&tt.test(s[A]);)A++;let t=A;for(;G(s.charCodeAt(t));)t++;if("("===s[t])return A=t+1,i(),41===s.charCodeAt(A)&&(A++,59===s.charCodeAt(A))&&A++,!0}for(;A<s.length&&!B(s[A])&&!H(s.charCodeAt(A))&&(!t||58!==s.charCodeAt(A));)A++;if(58===s.charCodeAt(A-1)&&F.test(s.substring(e,A+2)))for(;A<s.length&&q.test(s[A]);)A++;if(A>e){for(;G(s.charCodeAt(A-1))&&0<A;)A--;e=s.slice(e,A);return C+="undefined"===e?"null":JSON.stringify(e),s.charCodeAt(A)===S&&A++,!0}}function $(t){let e=t;for(;0<e&&G(s.charCodeAt(e));)e--;return e}function n(){return A>=s.length||U(s[A])||G(s.charCodeAt(A))}function o(t){C+=s.slice(t,A)+"0"}function h(){throw new w("Colon expected",A)}}});
{
"name": "jsonrepair",
"version": "3.9.0",
"version": "3.10.0",
"description": "Repair broken JSON documents",

@@ -5,0 +5,0 @@ "repository": {

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

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