non-blocking-json
Advanced tools
Comparing version 1.1.0-1596109441858 to 1.1.0-1596113581708
@@ -23,13 +23,11 @@ import { __awaiter } from "tslib"; | ||
let tickLength = 0; | ||
tick(() => { | ||
while (currentLength && tickLength < BATCH_LENGTH) { | ||
const queueItem = queue.shift(); | ||
queueItem.cb(); | ||
tickLength += queueItem.length; | ||
currentLength -= queueItem.length; | ||
} | ||
if (queue.length) { | ||
run(); | ||
} | ||
}); | ||
while (currentLength && tickLength < BATCH_LENGTH) { | ||
const queueItem = queue.shift(); | ||
queueItem.cb(); | ||
tickLength += queueItem.length; | ||
currentLength -= queueItem.length; | ||
} | ||
if (queue.length) { | ||
tick(run); | ||
} | ||
} | ||
@@ -187,3 +185,4 @@ return (length, cb) => { | ||
const startIndex = index * BATCH_LENGTH; | ||
for (let charIndex = startIndex; charIndex < startIndex + length; charIndex++) { | ||
let endIndex = startIndex + length; | ||
for (let charIndex = startIndex; charIndex < endIndex; charIndex++) { | ||
if (value[charIndex] === '"' && value[charIndex - 1] !== '\\') { | ||
@@ -205,3 +204,4 @@ isInString = !isInString; | ||
const id = `$$REF_${refId++}`; | ||
references[id] = value.substr(openingBracketIndex, charIndex - openingBracketIndex + 1); | ||
const ref = value.substr(openingBracketIndex, charIndex - openingBracketIndex + 1); | ||
references[id] = ref; | ||
value = | ||
@@ -212,2 +212,3 @@ value.substr(0, openingBracketIndex) + | ||
charIndex = openingBracketIndex + id.length + 1; | ||
endIndex += id.length; | ||
} | ||
@@ -223,2 +224,3 @@ else if (value[charIndex] === "]") { | ||
charIndex = openingBracketIndex + id.length + 1; | ||
endIndex += id.length; | ||
} | ||
@@ -225,0 +227,0 @@ } |
@@ -25,13 +25,11 @@ "use strict"; | ||
let tickLength = 0; | ||
tick(() => { | ||
while (currentLength && tickLength < BATCH_LENGTH) { | ||
const queueItem = queue.shift(); | ||
queueItem.cb(); | ||
tickLength += queueItem.length; | ||
currentLength -= queueItem.length; | ||
} | ||
if (queue.length) { | ||
run(); | ||
} | ||
}); | ||
while (currentLength && tickLength < BATCH_LENGTH) { | ||
const queueItem = queue.shift(); | ||
queueItem.cb(); | ||
tickLength += queueItem.length; | ||
currentLength -= queueItem.length; | ||
} | ||
if (queue.length) { | ||
tick(run); | ||
} | ||
} | ||
@@ -190,3 +188,4 @@ return (length, cb) => { | ||
const startIndex = index * BATCH_LENGTH; | ||
for (let charIndex = startIndex; charIndex < startIndex + length; charIndex++) { | ||
let endIndex = startIndex + length; | ||
for (let charIndex = startIndex; charIndex < endIndex; charIndex++) { | ||
if (value[charIndex] === '"' && value[charIndex - 1] !== '\\') { | ||
@@ -208,3 +207,4 @@ isInString = !isInString; | ||
const id = `$$REF_${refId++}`; | ||
references[id] = value.substr(openingBracketIndex, charIndex - openingBracketIndex + 1); | ||
const ref = value.substr(openingBracketIndex, charIndex - openingBracketIndex + 1); | ||
references[id] = ref; | ||
value = | ||
@@ -215,2 +215,3 @@ value.substr(0, openingBracketIndex) + | ||
charIndex = openingBracketIndex + id.length + 1; | ||
endIndex += id.length; | ||
} | ||
@@ -226,2 +227,3 @@ else if (value[charIndex] === "]") { | ||
charIndex = openingBracketIndex + id.length + 1; | ||
endIndex += id.length; | ||
} | ||
@@ -228,0 +230,0 @@ } |
{ | ||
"name": "non-blocking-json", | ||
"version": "1.1.0-1596109441858", | ||
"version": "1.1.0-1596113581708", | ||
"description": "Async JSON parse and stringify", | ||
@@ -5,0 +5,0 @@ "author": "Christian Alfoni <christianalfoni@gmail.com>", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
58291
518