Skip to content

Commit

Permalink
- Refactoring: Remove apparently extra code
Browse files Browse the repository at this point in the history
  • Loading branch information
brettz9 committed Jan 13, 2020
1 parent d6fbe1f commit d4a74a6
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/jsonpath.js
Original file line number Diff line number Diff line change
Expand Up @@ -468,13 +468,11 @@ JSONPath.prototype._trace = function (
} else if (loc === '^') {
// This is not a final endpoint, so we do not invoke the callback here
this._hasParentSelector = true;
return path.length
? {
path: path.slice(0, -1),
expr: x,
isParentSelector: true
}
: [];
return {
path: path.slice(0, -1),
expr: x,
isParentSelector: true
};
} else if (loc === '~') { // property name
retObj = {
path: push(path, loc),
Expand Down Expand Up @@ -595,7 +593,7 @@ JSONPath.prototype._trace = function (
}
// simple case--directly follow property
} else if (
!literalPriority && (val || val === '') && hasOwnProp.call(val, loc)
!literalPriority && val && hasOwnProp.call(val, loc)
) {
addRet(
this._trace(x, val[loc], push(path, loc), val, loc, callback,
Expand Down

0 comments on commit d4a74a6

Please sign in to comment.