JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1824
  • Score
    100M100P100Q106757F
  • License ISC

Combine a stream with the latest value from another stream

Package Exports

  • pull-with-latest

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (pull-with-latest) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

pull with latest

Combine a stream with the latest value from another stream

example

var withLatest = require('pull-with-latest')
var S = require('pull-stream')

var stream = S(
    S.values(['a','b','c']),
    S.asyncMap(function (ev, cb) {
        setTimeout(function () {
            cb(null, ev)
        }, 210)
    })
)

// this is twice as fast as `stream`, but only the most recent
// value gets sent to the sink
var other = S(
    S.values([1,2,3,4,5,6]),
    S.asyncMap(function (ev, cb) {
        setTimeout(function () {
            cb(null, ev)
        }, 100)
    })
)

S(
    withLatest(stream, other),
    S.log()
    //   ['a', 2],
    //   ['b', 4],
    //   ['c', 6]
)