ReferencetakeWhile
Reference · 108
takeWhile
takeWhile
Takes values while the predicate is true.
Signature
takeWhile(predicate: (value: T, index: number) => boolean, inclusive?: boolean): MonoTypeOperatorFunction
What it does
Passes values through while the predicate returns true. On the first false it completes the stream; inclusive can include that last value.
When to use
Reading a stream up to a stop condition: progress < 100, status not final, values within an allowed range.
See also
skipWhile, takeUntil, filter
script.ts
CONSOLE · Console output
Hit Run to see the result...