8000 GitHub - ng-bs/rxjs-utils
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

ng-bs/rxjs-utils

Repository files navigation

@ngbs/rxjs

A collection of RxJS utilities.

Operators

mapArrayFilter

Filter an array in an Observable.

of([1, 2, 3, 4])
  .pipe(mapArrayFilter(x => x % 2 === 0))
  .subscribe(console.log);
// [ 2, 4 ]

mapArrayMap

Map an array in an Observable.

of([1, 2, 3, 4])
  .pipe(mapArrayMap(x => x * 2))
  .subscribe(console.log);
// [ 2, 4, 6, 8 ]

mapArrayReduce

Reduce an array in an Observable.

of([1, 2, 3, 4])
  .pipe(mapArrayReduce((acc, cur) => acc + cur, 0))
  .subscribe(console.log);
// 10

mapArrayReduceRight

Reduce an array in an Observable, right to left.

of(['a', 'b', 'c', 'd'])
  .pipe(mapArrayReduceRight((acc, cur) => acc + cur, ''))
  .subscribe(console.log);
// 'dcba'

mapArrayReverse

Reverses an array in an Observable.

of([1, 2, 3, 4, 5])
  .pipe(mapArrayReverse())
  .subscribe(console.log);
// [5, 4, 3, 2, 1]

mapArraySort

Sorts an array in an Observable.

of([3, 1, 5, 2, 4])
  .pipe(mapArraySort())
  .subscribe(console.log);
// [1, 2, 3, 4, 5]
of([3, 1, 5, 2, 4])
  .pipe(mapArraySort((a, b) => a > b ? -1 : 1))
  .subscribe(console.log);
// [5, 4, 3, 2, 1]

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  
0