Skip to content

Commit 45a3ed0

Browse files
authored
perf: Improve performance of recursive pointer iterations (#8741)
1 parent 977edea commit 45a3ed0

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

src/RestQuery.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,11 +1066,7 @@ function includePath(config, auth, response, path, restOptions = {}) {
10661066
// Returns a list of pointers in REST format.
10671067
function findPointers(object, path) {
10681068
if (object instanceof Array) {
1069-
var answer = [];
1070-
for (var x of object) {
1071-
answer = answer.concat(findPointers(x, path));
1072-
}
1073-
return answer;
1069+
return object.map(x => findPointers(x, path)).flat();
10741070
}
10751071

10761072
if (typeof object !== 'object' || !object) {

0 commit comments

Comments
 (0)