From d1291f67551c58168af43698a359cb5ddfd266b0 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Thu, 3 Nov 2016 01:33:53 +0100 Subject: node_modules --- node_modules/unique-stream/README.md | 50 +++++++++++++++++++++++++++++++++--- 1 file changed, 47 insertions(+), 3 deletions(-) (limited to 'node_modules/unique-stream/README.md') diff --git a/node_modules/unique-stream/README.md b/node_modules/unique-stream/README.md index f19b20a37..fce2ec019 100644 --- a/node_modules/unique-stream/README.md +++ b/node_modules/unique-stream/README.md @@ -2,11 +2,12 @@ node.js through stream that emits a unique stream of objects based on criteria -[![build status](https://secure.travis-ci.org/eugeneware/unique-stream.png)](http://travis-ci.org/eugeneware/unique-stream) +[![Build Status](https://travis-ci.org/eugeneware/unique-stream.svg?branch=master)](https://travis-ci.org/eugeneware/unique-stream) +[![Coverage Status](https://coveralls.io/repos/eugeneware/unique-stream/badge.svg?branch=master&service=github)](https://coveralls.io/github/eugeneware/unique-stream?branch=master) ## Installation -Install via npm: +Install via [npm](https://www.npmjs.com/): ``` $ npm install unique-stream @@ -28,7 +29,7 @@ function makeStreamOfObjects() { for (var i = 0; i < 3; i++) { setImmediate(function () { s.emit('data', { name: 'Bob', number: 123 }); - --count && end(); + --count || end(); }); } @@ -87,3 +88,46 @@ makeStreamOfObjects() aggregator.on('data', console.log); ``` + +## Use a custom store to record keys that have been encountered + +By default a set is used to store keys encountered so far, in order to check new ones for +uniqueness. You can supply your own store instead, providing it supports the add(key) and +has(key) methods. This could allow you to use a persistant store so that already encountered +objects are not re-streamed when node is reloaded. + +``` js +var keyStore = { + store: {}, + + add: function(key) { + this.store[key] = true; + }, + + has: function(key) { + return this.store[key] !== undefined; + } +}; + +makeStreamOfObjects() + .pipe(unique('name', keyStore)) + .on('data', console.log); +``` + +## Contributing + +unique-stream is an **OPEN Open Source Project**. This means that: + +> Individuals making significant and valuable contributions are given commit-access to the project to contribute as they see fit. This project is more like an open wiki than a standard guarded open source project. + +See the [CONTRIBUTING.md](https://github.com/eugeneware/unique-stream/blob/master/CONTRIBUTING.md) file for more details. + +### Contributors + +unique-stream is only possible due to the excellent work of the following contributors: + + + + + +
Eugene WareGitHub/eugeneware
Craig AmbroseGitHub/craigambrose
Shinnosuke WatanabeGitHub/shinnn
-- cgit v1.2.3