Skip to content

Commit

Permalink
perf: Improve performance of recursive pointer iterations (parse-comm…
Browse files Browse the repository at this point in the history
  • Loading branch information
chderen authored Sep 13, 2023
1 parent 977edea commit 45a3ed0
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/RestQuery.js
Original file line number Diff line number Diff line change
Expand Up @@ -1066,11 +1066,7 @@ function includePath(config, auth, response, path, restOptions = {}) {
// Returns a list of pointers in REST format.
function findPointers(object, path) {
if (object instanceof Array) {
var answer = [];
for (var x of object) {
answer = answer.concat(findPointers(x, path));
}
return answer;
return object.map(x => findPointers(x, path)).flat();
}

if (typeof object !== 'object' || !object) {
Expand Down

0 comments on commit 45a3ed0

Please sign in to comment.