Utilities for RxJS. Provides additional operators as well as tslint rules to avoid common mistakes.
Please see API documentation
- 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.
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
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
});
❤️ theCodeCampus - Trainings for Angular and TypeScript
- Diagram generation from RxJS