dedupe-stream

A stream that prevents consecutive duplicate emissions.

Showing:

Popularity

Downloads/wk

1

GitHub Stars

3

Maintenance

Last Commit

7yrs ago

Contributors

1

Package

Dependencies

2

License

Apache-2.0

Type Definitions

Tree-Shakeable

No?

Categories

Readme

dedupe-stream

A stream that prevents consecutive duplicate emissions.

Build Status npm install

Example

var dedupeStream = require('dedupe-stream')

var dedupe = dedupeStream()

dedupe.write({fruit: 'apples'}) // emits {fruit: 'apples'}

dedupe.write({fruit: 'apples'}) // does not emit

dedupe.write({fruit: 'oranges'}) // emits {fruit: 'oranges'}

API

dedupe() -> DuplexStream

  • Input is anything (See "Notes" below)
  • Output is whatever you wrote, assuming it is unique compared to the previous emission.

Notes

Internally, dedupeStream clones the emitted value using JSON.parse(JSON.stringify(obj))) in order to avoid downstream changes from throwing off the equality check. This means that things that aren't faithfully JSON.stringifyed, such as functions and objects with circular references, will cause an error to throw.

License

This project is licensed under the Apache License, Version 2.0. See LICENSE for the full license.

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100
No reviews found
Be the first to rate

Alternatives

No alternatives found

Tutorials

No tutorials found
Add a tutorial