rxjs-multi-scan
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

multiScan operator for RxJS

rxjs-multi-scan

A combination operator that combines multiple sources of scan operations.

Installation

Install using NPM CLI

npm install --save rxjs-multi-scan

or using Yarn CLI

yarn add rxjs-multi-scan

Use cases

Create a reactive state container that reacts to multiple observables with a simple, easy-to-read syntax. Each source is combined with a reducer function to reduce the current state and the emitted value to a new state.

Usage

import { Observable, Subject } from 'rxjs';
import { multiScan } from 'rxjs-multi-scan';
 
const initialCount: number = 0;
const add: Subject<number> = new Subject();
const subtract: Subject<number> = new Subject();
const count: Observable<number> = multiScan(
  add, (count, addend) => count + addend,
  subtract, (count, subtrahend) => count - subtrahend,
  initialCount);

Package Sidebar

Install

npm i rxjs-multi-scan

Weekly Downloads

54

Version

1.0.2

License

MIT

Unpacked Size

150 kB

Total Files

29

Last publish

Collaborators

  • layzee