From aae155924bbeecac33a7dbf6ab0097ff3658b053 Mon Sep 17 00:00:00 2001 From: Nikolay Anestev Date: Thu, 13 Oct 2016 21:18:39 +0100 Subject: [PATCH] Support for multiple matching arrays. --- lib/jsonpath-object-transform.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/jsonpath-object-transform.js b/lib/jsonpath-object-transform.js index 022db64..2a9d46a 100644 --- a/lib/jsonpath-object-transform.js +++ b/lib/jsonpath-object-transform.js @@ -97,8 +97,11 @@ if (seek.length && subpath) { result = result[key] = []; - seek[0].forEach(function(item, index) { - walk(item, subpath, result, index); + var index = 0; + seek.forEach(function(item){ + item.forEach(function (item) { + walk(item, subpath, result, index++); + }); }); } else { result[key] = seek;