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

1.0.0 • Public • Published

@basic-streams/filter

filter<T>(predicate: (x: T) => boolean, stream: Stream<T>): Stream<T>

Creates a stream containing values from the source stream that satisfy the given predicate.

import ofMany from "@basic-streams/of-many"
import filter from "@basic-streams/filter"

const stream = ofMany([1, 2, 3], 5000)
const result = filter(x => x !== 2, stream)

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

// > 1
// > 3

// stream: ____1____2____3
// result: ____1_________3

Readme

Keywords

Package Sidebar

Install

npm i @basic-streams/filter

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

3.61 kB

Total Files

8

Last publish

Collaborators

  • pozadi