[Pkg-javascript-commits] [node-jsonstream] 119/214: add full element path as an argument to `map`

Bastien Roucariès rouca at moszumanska.debian.org
Fri Dec 1 12:58:48 UTC 2017


This is an automated email from the git hooks/post-receive script.

rouca pushed a commit to branch master
in repository node-jsonstream.

commit 8c00cf6a2e4b04a66b0810ae9fe265aa4765be16
Author: Uri Shaked <uri at salsa4fun.co.il>
Date:   Tue May 20 01:37:32 2014 +0300

    add full element path as an argument to `map`
---
 index.js | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/index.js b/index.js
index 9fd0a39..5a2e496 100755
--- a/index.js
+++ b/index.js
@@ -82,9 +82,10 @@ exports.parse = function (path, map) {
     if (j !== this.stack.length) return
 
     count ++
+    var actualPath = this.stack.slice(1).map(function(element) { return element.key }).concat([this.key])
     var data = this.value[this.key]
     if(null != data)
-      if(null != (data = map ? map(data) : data))
+      if(null != (data = map ? map(data, actualPath) : data))
         stream.queue(data)
     delete this.value[this.key]
   }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-jsonstream.git



More information about the Pkg-javascript-commits mailing list