Socket
Book a DemoInstallSign in
Socket

dedupe-stream

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dedupe-stream

dedupe consecutive stream emissions

1.1.0
latest
Source
npmnpm
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

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.

Keywords

dedupe

FAQs

Package last updated on 15 May 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.