[Pkg-javascript-commits] [node-jsonstream] 77/214: document string wildcards

Bastien Roucariès rouca at moszumanska.debian.org
Fri Dec 1 12:58:42 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 3f38a48506a6dd47b676e25c5f2729f7f5f7cd6f
Author: Dominic Tarr <dominic.tarr at gmail.com>
Date:   Sat Mar 16 15:46:21 2013 +1300

    document string wildcards
---
 readme.markdown | 36 ++++++++++++++++--------------------
 1 file changed, 16 insertions(+), 20 deletions(-)

diff --git a/readme.markdown b/readme.markdown
index 361d6cb..dc23a0f 100644
--- a/readme.markdown
+++ b/readme.markdown
@@ -6,7 +6,7 @@ streaming JSON.parse and stringify
 
 ## example
 
-```javascript
+``` js
 
 var request = require('request')
   , JSONStream = require('JSONStream')
@@ -18,36 +18,32 @@ var parser = JSONStream.parse(['rows', true])
       console.error(data)
       return data
     })
-```
-
-in node 0.4.x
-
-``` javascript
-
-req.pipe(parser)
-parser.pipe(logger)
 
+  request({url: 'http://isaacs.couchone.com/registry/_all_docs'})
+    .pipe(JSONStream.parse('rows.*'))
+    .pipe(es.mapSync(function (data) {
+      console.error(data)
+      return data
+    }))
 ```
 
-in node v0.5.x
+## JSONStream.parse(path)
 
-``` javascript
-req.pipe(parser).pipe(logger)
+parse stream of values that match a path
 
+``` js
+  JSONStream.parse('rows.*.doc')
 ```
 
-## JSONStream.parse(path)
-
-usally, a json API will return a list of objects.
+If your keys have keys that include `.` or `*` etc, use an array instead.
+`['row', true, /^doc/]`.
 
-`path` should be an array of property names, `RegExp`s, booleans, and/or functions.
+If you use an array, `RegExp`s, booleans, and/or functions.
 any object that matches the path will be emitted as 'data' (and `pipe`d down stream)
 
-a 'root' event is emitted when all data has been received. The 'root' event passes the root object & the count of matched objects.
-
-if `path` is empty or null, no 'data' events are emitted.
+If `path` is empty or null, no 'data' events are emitted.
 
-### example
+### Example
 
 query a couchdb view:
 

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