Socket
Socket
Sign inDemoInstall

pull-sink-through

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

pull-sink-through

convert a pull-stream sink (that takes a callback) into a through steam that outputs a single item. Useful when you have an api that needs to return a source stream, but may be either a source or an async function.


Version published
Weekly downloads
47
increased by67.86%
Maintainers
1
Weekly downloads
 
Created
Source

pull-sink-through

convert a pull-stream sink (that takes a callback) into a through steam that outputs a single item. Useful when you have an api that needs to return a source stream, but may be either a source or an async function.

Used by map-filter-reduce, because if a reduce is included it's a sink with a callback.

function sum () {
  return SinkThrough(function (cb) {
    pull.reduce(function (a, b) {
      return a + b
    }, 0, cb)
  })
}

pull(
  pull.count(100),
  sum,
  pull.collect(function (err, ary) {
    console.log(ary) // => [5500]
  })
)

License

MIT

FAQs

Package last updated on 28 Feb 2016

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc