An operator equal to the takeWhile operator but also emits the last value.
npm install rxjs-take-while-inclusive
__Note: This package is no longer needed as of
rxjs@6.4.0 as the
operator now takes an extra parameter which when true will also emit the last value.
See rxjs#4115.__
Example usage
``TypeScript
import { takeWhileInclusive } from 'rxjs-take-while-inclusive';
import { interval } from 'rxjs/observable/interval';
interval(1000).pipe(
takeWhileInclusive(v => v < 5),
).subscribe(console.log);
// Prints: 0, 1, 2, 3, 4, 5
`
Emits values emitted by the source Observable so long as each value satisfies
the given predicate, and then completes after the last emitted value satisfiespredicate
the . takeWhileInclusive subscribes and begins mirroring thepredicate
source Observable. Each value emitted on the source is emitted then given to the function which returns a boolean, representing a condition to bepredicate
satisfied by the source values. The output Observable emits the source values
until such time as the returns false, at which pointtakeWhileInclusive stops mirroring the source Observable and completes the
output Observable.
`javascript``
const {takeWhileInclusive} = require('rxjs-take-while-inclusive');