[Pkg-javascript-commits] [node-jsonstream] 203/214: Added emitPath example to readme

Bastien Roucariès rouca at moszumanska.debian.org
Fri Dec 1 12:59:00 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 af9030f9c454bbde185fb54e24cb44c0ebbd1042
Author: nathan <nathanj.wills at gmail.com>
Date:   Fri Dec 16 10:36:16 2016 +1100

    Added emitPath example to readme
---
 readme.markdown | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/readme.markdown b/readme.markdown
index 3d3fc23..422c3df 100644
--- a/readme.markdown
+++ b/readme.markdown
@@ -104,6 +104,18 @@ stream.on('data', function(data) {
 
 ```
 
+You can also emit the path:
+
+``` js
+var stream = JSONStream.parse(['rows', true, 'doc', {emitPath: true}]) //rows, ANYTHING, doc, items in docs with keys
+
+stream.on('data', function(data) {
+  console.log('path:', data.path);
+  console.log('value:', data.value);
+});
+
+```
+
 ### recursive patterns (..)
 
 `JSONStream.parse('docs..value')` 

-- 
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