JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 577
  • Score
    100M100P100Q110739F
  • License MIT

An operator equal to the takeWhile operator but also emits the last value.

Package Exports

  • rxjs-take-while-inclusive

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (rxjs-take-while-inclusive) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

TakeWhileInclusive

A takeWhile variant which also emits the value not satisfying the predicate before completing.

Example usage

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 satisfies the predicate. takeWhileInclusive subscribes and begins mirroring the source Observable. Each value emitted on the source is emitted then given to the predicate function which returns a boolean, representing a condition to be satisfied by the source values. The output Observable emits the source values until such time as the predicate returns false, at which point takeWhileInclusive stops mirroring the source Observable and completes the output Observable.