Skip to content

Commit d4a74a6

Browse files
committed
- Refactoring: Remove apparently extra code
1 parent d6fbe1f commit d4a74a6

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/jsonpath.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -468,13 +468,11 @@ JSONPath.prototype._trace = function (
468468
} else if (loc === '^') {
469469
// This is not a final endpoint, so we do not invoke the callback here
470470
this._hasParentSelector = true;
471-
return path.length
472-
? {
473-
path: path.slice(0, -1),
474-
expr: x,
475-
isParentSelector: true
476-
}
477-
: [];
471+
return {
472+
path: path.slice(0, -1),
473+
expr: x,
474+
isParentSelector: true
475+
};
478476
} else if (loc === '~') { // property name
479477
retObj = {
480478
path: push(path, loc),
@@ -595,7 +593,7 @@ JSONPath.prototype._trace = function (
595593
}
596594
// simple case--directly follow property
597595
} else if (
598-
!literalPriority && (val || val === '') && hasOwnProp.call(val, loc)
596+
!literalPriority && val && hasOwnProp.call(val, loc)
599597
) {
600598
addRet(
601599
this._trace(x, val[loc], push(path, loc), val, loc, callback,

0 commit comments

Comments
 (0)