1.0.0 • Published 7 years ago

@basic-streams/take-while v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
7 years ago

@basic-streams/take-while

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

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

import ofMany from "@basic-streams/of-many"
import takeWhile from "@basic-streams/take-while"

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

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

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

// > 0
// > 1

// stream: ____0____1____2!
// result: ____0____1
1.0.0

7 years ago

0.0.10

7 years ago

0.0.9

7 years ago

0.0.7

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.1

7 years ago