Comparing version 3.0.2 to 3.0.3
@@ -45,11 +45,20 @@ export function parsePath(path) { | ||
} | ||
else // ['segment name'] form | ||
else // ['segment name'] or [number] form | ||
{ | ||
if (path.charAt(pos + 1) !== "'") | ||
bail(); | ||
const lastPos = path.indexOf("']", pos + 2); | ||
if (lastPos === -1) | ||
bail(); | ||
ret.push(path.slice(pos + 2, lastPos)); | ||
pos = lastPos + 2; | ||
if (path.charAt(pos + 1).match(/[0-9]/)) { | ||
const lastPos = path.indexOf("]", pos + 1); | ||
if (lastPos === -1) | ||
bail(); | ||
ret.push(path.slice(pos + 1, lastPos)); | ||
pos = lastPos + 1; | ||
} | ||
else { | ||
if (path.charAt(pos + 1) !== "'") | ||
bail(); | ||
const lastPos = path.indexOf("']", pos + 2); | ||
if (lastPos === -1) | ||
bail(); | ||
ret.push(path.slice(pos + 2, lastPos)); | ||
pos = lastPos + 2; | ||
} | ||
} | ||
@@ -56,0 +65,0 @@ } |
{ | ||
"name": "jsonpos", | ||
"version": "3.0.2", | ||
"version": "3.0.3", | ||
"description": "Get the textual position of a property in a JSON text", | ||
@@ -5,0 +5,0 @@ "author": "Gustaf Räntilä", |
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
15078
195