Comparing version 4.0.0-beta.0 to 4.0.0-beta.1
@@ -18,6 +18,6 @@ /** | ||
const { dotIndex, key, remaining } = state(kp); | ||
const kpVal = kp in obj ? obj[kp] : null; | ||
const kpVal = typeof obj === 'object' && kp in obj ? obj[kp] : null; | ||
const keyVal = key in obj ? obj[key] : null; | ||
// If there is a '.' in the key path and the key path doesn't appear in the object, recur on the subobject | ||
if (dotIndex >= 0 && !kpVal) { | ||
if (dotIndex >= 0 && typeof obj === 'object' && !(kp in obj)) { | ||
// If there's an array at the current key in the object, then iterate over those items evaluating the remaining path | ||
@@ -34,7 +34,7 @@ if (Array.isArray(keyVal)) { | ||
} | ||
else if (dotIndex >= 0 && kp !== key && keyVal) { | ||
else if (dotIndex >= 0 && kp !== key && typeof obj === 'object' && key in obj) { | ||
// If there's a field with a non-nested dot, then recur into that sub-value | ||
return evaluatePath(keyVal, remaining); | ||
} | ||
else if (dotIndex === -1 && keyVal && !kpVal) { | ||
else if (dotIndex === -1 && typeof obj === 'object' && key in obj && !(kp in obj)) { | ||
// If the field is here, but the key was escaped | ||
@@ -41,0 +41,0 @@ return keyVal; |
@@ -5,3 +5,3 @@ { | ||
"description": "A document path library for Node", | ||
"version": "4.0.0-beta.0", | ||
"version": "4.0.0-beta.1", | ||
"homepage": "https://mrodrig.github.io/doc-path", | ||
@@ -8,0 +8,0 @@ "repository": { |
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
14179