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

1.0.0 • Public • Published

@basic-streams/skip-while

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

Creates a stream containing each value from the given stream starting from the first value x for which predicate(x) returns false.

import ofMany from "@basic-streams/of-many"
import skipWhile from "@basic-streams/skip-while"

const stream = ofMany([0, 1, 2, 1], 5000)

const result = skipWhile(x => x < 2, stream)

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

// > 2
// > 1

// stream: ____0____1____2____1
// result: ______________2____1

Package Sidebar

Install

npm i @basic-streams/skip-while

Weekly Downloads

20

Version

1.0.0

License

MIT

Unpacked Size

4.63 kB

Total Files

8

Last publish

Collaborators

  • pozadi