@w11k/rx-ninja
v5.0.0
Published
[![Build Status](https://travis-ci.org/w11k/rx-ninja.svg?branch=master)](https://travis-ci.org/w11k/rx-ninja) [![npm version](https://badge.fury.io/js/%40w11k%2Frx-ninja.svg)](https://badge.fury.io/js/%40w11k%2Frx-ninja)
Downloads
913
Keywords
Readme
rx-ninja
Utilities for RxJS. Provides additional operators as well as tslint rules to avoid common mistakes.
API Documentation
Please see API documentation
Operators
- combineLatestToMap
- debounceIf
- distinctUntilChangedDeep
- executeLatestOnIdle
- mapToValueAndChangedProperties
- onCompletionContinueWith
- onlyInstanceOf
- onUnsubscribe
- replayOn
- rateLimitLossless + rateLimitLossy
- shareReplayUntilAllUnsubscribed
- skipNil
- skipNull
- skipPathNil
- skipPropertyNil
- skipPropertyNull
- skipPropertyUndefined
- skipSomePropertyNil
- skipSomePropertyNull
- skipSomePropertyUndefined
- skipUndefined
- skipUntilCompletionAndContinueWith
- startWith
- takeUntilCompletion
Please use the API documentation for an always up-to-date list of all included operators. The API documentation also contains detailed descriptions, examples and marble diagrams.
TSLint rules
Installation
Adjust your tslint.json
{
"rulesDirectory": [
"node_modules/@w11k/rx-ninja/dist/bundle/tslint_rules"
],
"rules": {
"rx-ninja-subscribe-takeuntil": true,
"rx-ninja-subscribe-in-subscribe": true
}
}
Run tslint with type info
tslint -p tsconfig.json -t verbose
Rule descriptions
rx-ninja-subscribe-takeuntil
This rule triggers when Observable#subscribe()
is called and then enforces that
.pipe()
is called directly before.subscribe()
- and that either
takeUntil()
or one of a specified finalizer operators is called as the last pipe operator
You can filter the files where this rules applies with fileSuffix
and excludedFileSuffix
.
Configuration:
"rx-ninja-subscribe-takeuntil": [
true,
{
"finalizer": [
"takeUntil",
"customOperator",
"anotherOperator"
],
"fileSuffix": [
".ts"
],
"excludedFileSuffix": [
".spec.ts",
".test.ts"
]
}
]
rx-ninja-subscribe-in-subscribe
This rule triggers when Observable#subscribe()
is called inside another Observable#subscribe()
call, e.g.
import {of} from "rxjs";
of(1).subscribe(() => {
of(2).subscribe(); // <-- error
});
Utilities
Patrons
❤️ theCodeCampus - Trainings for Angular and TypeScript
Thanks
- Diagram generation from RxJS