filter()
filter<
T
>(predicate
): (arr
) =>T
[]
Returns a copy of the given array of elements that satisfy the predicate.
Type Parameters
• T
The type of array elements.
Parameters
predicate
Predicate
<T
>
A predicate function to apply to each element of the array.
Returns
Function
Parameters
arr
T
[]
Returns
T
[]
Remarks
pure function
Example
import { filter } from '@accelint/core';
filter(x => !(x & 1))([1, 2, 3, 4, 5]);
// [2, 4]