@basic-streams/combine-array
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

@basic-streams/combine-array

combineArray<T>(streams: Array<Stream<T>>): Stream<Array<T>>

Creates a stream containing arrays of the latest values from given streams. The result stream updates when any of source stream updates.

import ofMany from "@basic-streams/of-many"
import combineArray from "@basic-streams/combine-array"

const stream1 = ofMany([2, 4], 10000)
const stream2 = ofMany([1, 3], 8000)
const result = combineArray([stream1, stream2])

result(x => {
  console.log(x)
})

// > [2, 1]
// > [2, 3]
// > [4, 3]

// stream1: _________2_________4
// stream2: _______1_______3
// result:  _________._____.___.
//              [2, 1] [2, 3] [4, 3]

Package Sidebar

Install

npm i @basic-streams/combine-array

Weekly Downloads

89

Version

1.0.0

License

MIT

Unpacked Size

5.74 kB

Total Files

8

Last publish

Collaborators

  • pozadi