aboutsummaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/sorted-union-stream/README.md
diff options
context:
space:
mode:
authorKat Marchán <kzm@sykosomatic.org>2016-12-18 20:22:09 -0800
committerMyles Borins <myles.borins@gmail.com>2016-12-28 15:30:50 -0500
commit9946519fba73687d34dccd5813808252a1973f3c (patch)
tree74d7194d2a00743bcd905027195e7e8000c5ac5a /deps/npm/node_modules/sorted-union-stream/README.md
parent4d3b487b791606ea965f6280ce0eeea03d79b660 (diff)
downloadandroid-node-v8-9946519fba73687d34dccd5813808252a1973f3c.tar.gz
android-node-v8-9946519fba73687d34dccd5813808252a1973f3c.tar.bz2
android-node-v8-9946519fba73687d34dccd5813808252a1973f3c.zip
deps: upgrade npm to 4.0.5
PR-URL: https://github.com/nodejs/node/pull/10330 Reviewed-By: Myles Borins <myles.borins@gmail.com>
Diffstat (limited to 'deps/npm/node_modules/sorted-union-stream/README.md')
-rw-r--r--deps/npm/node_modules/sorted-union-stream/README.md80
1 files changed, 80 insertions, 0 deletions
diff --git a/deps/npm/node_modules/sorted-union-stream/README.md b/deps/npm/node_modules/sorted-union-stream/README.md
new file mode 100644
index 0000000000..bb2959b0de
--- /dev/null
+++ b/deps/npm/node_modules/sorted-union-stream/README.md
@@ -0,0 +1,80 @@
+# sorted-union-stream
+
+Get the union of two sorted streams
+
+```
+npm install sorted-union-stream
+```
+
+[![build status](https://secure.travis-ci.org/mafintosh/sorted-union-stream.png)](http://travis-ci.org/mafintosh/sorted-union-stream)
+
+## Usage
+
+``` js
+var union = require('sorted-union-stream')
+var from = require('from2-array')
+
+// es.readArray converts an array into a stream
+var sorted1 = from.obj([1,10,24,42,43,50,55])
+var sorted2 = from.obj([10,42,53,55,60])
+
+// combine the two streams into a single sorted stream
+var u = union(sorted1, sorted2)
+
+u.on('data', function(data) {
+ console.log(data)
+})
+u.on('end', function() {
+ console.log('no more data')
+})
+```
+
+Running the above example will print
+
+```
+1
+10
+24
+42
+43
+50
+53
+55
+60
+no more data
+```
+
+## Streaming objects
+
+If you are streaming objects sorting is based on `.key`.
+
+If this property is not present you should add a `toKey` function as the third parameter.
+`toKey` should return an key representation of the data that can be used to compare objects.
+
+_The keys MUST be sorted_
+
+``` js
+var sorted1 = from.obj([{foo:'a'}, {foo:'b'}, {foo:'c'}])
+var sorted2 = from.obj([{foo:'b'}, {foo:'d'}])
+
+var u = union(sorted1, sorted2, function(data) {
+ return data.foo // the foo property is sorted
+})
+
+union.on('data', function(data) {
+ console.log(data)
+});
+```
+
+Running the above will print
+
+```
+{foo:'a'}
+{foo:'b'}
+{foo:'c'}
+{foo:'d'}
+```
+
+## License
+
+MIT