0.2.0 • Published 7 years ago

rxjs-set-operators v0.2.0

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

rxjs-set-operators

npm version GitHub stars

RxJS pipeable operators for object stream.

Motivation

Since RxJS v6.x the resultSelector argument is deprecated.

Stream scheme

a -> { foo: a } -> { foo: a, bar: b } -> { foo: a, bar: b, baz: a + b }

Example

https://github.com/justerest/up-ng/blob/master/src/index.ts

from(['./foo', './bar/*.ts', './baz.html'])
    .pipe(
        setAll('pattern'),
        mergeSet('filePath', ({ pattern }) => getFileList(pattern)),
        set('outFilePath', ({ filePath }) => resolve(filePath)),
        mergeSet('isSuccess', ({ filePath, outFilePath }) => upgradeFile(filePath, outFilePath)),
        scanSet('counter', (acc, { pattern }) => {
            const index = acc[pattern] || 0;
            return ({ ...acc, [pattern]: index + 1 });
        }, {} as Record<string, number>),
    )
    .subscribe(({ pattern, filePath, outFilePath, isSuccess, counter }) => {
        // ...
    });

Operators

  • mergeSet
  • mergeTap
  • scanSet
  • set
  • setAll
  • switchSet
0.2.0

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago