Options
All
  • Public
  • Public/Protected
  • All
Menu

Module array/filter

Index

References

Functions

References

Renames and re-exports filter

Functions

  • filter<T>(fn: ArrPred<T>, arr: ArrayLike<T>): T[]
  • filter<T>(fn: ArrPred<T>): (arr: ArrayLike<T>) => T[]
  • Takes a predicate and a "arr", and returns a new array of the same type containing the members of the given arr which satisfy the given predicate.

    example
     var isEven = n => n % 2 === 0;

    filter(isEven, [1, 2, 3, 4]); //=> [2, 4]

    Type parameters

    • T

    Parameters

    • fn: ArrPred<T>

      predicate

    • arr: ArrayLike<T>

    Returns T[]

  • Takes a predicate and a "arr", and returns a new array of the same type containing the members of the given arr which satisfy the given predicate.

    example
     var isEven = n => n % 2 === 0;

    filter(isEven, [1, 2, 3, 4]); //=> [2, 4]

    Type parameters

    • T

    Parameters

    Returns (arr: ArrayLike<T>) => T[]

      • (arr: ArrayLike<T>): T[]
      • Parameters

        • arr: ArrayLike<T>

        Returns T[]

Generated using TypeDoc