@hyperjump/json-pointer
Advanced tools
Comparing version 0.7.0 to 0.8.0
@@ -119,12 +119,12 @@ const curry = require("just-curry-it"); | ||
const applySegment = (value, segment, cursor = "") => { | ||
if (isScalar(value)) { | ||
throw Error(`Value at '${cursor}' is a scalar and can't be indexed`); | ||
if (value === undefined) { | ||
throw TypeError(`Value at '${cursor}' is undefined and does not have property '${segment}'`); | ||
} else if (value === null) { | ||
throw TypeError(`Value at '${cursor}' is null and does not have property '${segment}'`); | ||
} else if (isScalar(value)) { | ||
throw TypeError(`Value at '${cursor}' is a ${typeof value} and does not have property '${segment}'`); | ||
} else { | ||
const computedSegment = computeSegment(value, segment); | ||
return value[computedSegment]; | ||
} | ||
const computedSegment = computeSegment(value, segment); | ||
if (!(computedSegment in value)) { | ||
throw Error(`Value at '${cursor}' does not have index '${computedSegment}'`); | ||
} | ||
return value[computedSegment]; | ||
}; | ||
@@ -131,0 +131,0 @@ |
{ | ||
"name": "@hyperjump/json-pointer", | ||
"version": "0.7.0", | ||
"version": "0.8.0", | ||
"description": "An RFC-6901 JSON Pointer implementation", | ||
@@ -8,3 +8,3 @@ "main": "lib/json-pointer.js", | ||
"clean": "xargs -a .gitignore rm -rf", | ||
"lint": "eslint .", | ||
"lint": "eslint lib", | ||
"test": "mocha 'lib/**/*.spec.js'" | ||
@@ -23,3 +23,3 @@ }, | ||
"eslint-import-resolver-node": "^0.3.2", | ||
"eslint-plugin-import": "^2.18.2", | ||
"eslint-plugin-import": "^2.20.2", | ||
"mocha": "^5.2.0" | ||
@@ -26,0 +26,0 @@ }, |
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
8161
113