Function: filter()
Call Signature
Section titled “Call Signature”filter<
T,S>(source,predicate):Sequence<S>
Same semantics as Array.prototype.filter, over a single Container.
A type-guard predicate narrows the resulting element type.
Type Parameters
Section titled “Type Parameters”T
S
Parameters
Section titled “Parameters”source
Section titled “source”Source<T>
The container to filter (nullish yields an empty sequence).
predicate
Section titled “predicate”(value, index) => value is S
Keeps elements for which it returns true.
Returns
Section titled “Returns”Sequence<S>
Call Signature
Section titled “Call Signature”filter<
T>(source,predicate):Sequence<T>
Same semantics as Array.prototype.filter, over a single Container.
A type-guard predicate narrows the resulting element type.
Type Parameters
Section titled “Type Parameters”T
Parameters
Section titled “Parameters”source
Section titled “source”Source<T>
The container to filter (nullish yields an empty sequence).
predicate
Section titled “predicate”(value, index) => boolean
Keeps elements for which it returns true.
Returns
Section titled “Returns”Sequence<T>