Referencepartition
Reference · 83
partition
partition
DeprecatedOperator form: splits the stream into two by a predicate.
Signature
partition(predicate: (value: T, index: number) => boolean): UnaryFunction, [Observable, Observable]>
What it does
Returns a pair of Observables: the first holds values where the predicate is true, the second holds the rest.
When to use
Supporting legacy code. In new code, use the top-level partition(source$, predicate), or two filters for clarity.
Deprecated API
Marked deprecated in RxJS 7. In new code, use partition(source$, predicate) or filter.
See also
filter
script.ts
CONSOLE · Console output
Hit Run to see the result...