Skip to content

Commit b1d2b29

Browse files
committed
- Refactoring: Remove unreachable code
1 parent 5f62848 commit b1d2b29

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

src/jsonpath.js

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -657,15 +657,14 @@ JSONPath.prototype._slice = function (
657657
const tmp = this._trace(
658658
unshift(i, expr), val, path, parent, parentPropName, callback, true
659659
);
660-
if (Array.isArray(tmp)) {
661-
// This was causing excessive stack size in Node (with or
662-
// without Babel) against our performance test: `ret.push(...tmp);`
663-
tmp.forEach((t) => {
664-
ret.push(t);
665-
});
666-
} else {
667-
ret.push(tmp);
668-
}
660+
// Should only be possible to be an array here since first part of
661+
// ``unshift(i, expr)` passed in above would not be empty, nor `~`,
662+
// nor begin with `@` (as could return objects)
663+
// This was causing excessive stack size in Node (with or
664+
// without Babel) against our performance test: `ret.push(...tmp);`
665+
tmp.forEach((t) => {
666+
ret.push(t);
667+
});
669668
}
670669
return ret;
671670
};

0 commit comments

Comments
 (0)