Options
All
  • Public
  • Public/Protected
  • All
Menu

Module object/filter

Index

References

Functions

References

Renames and re-exports filter

Functions

  • filter<O>(fn: ObjPred<keyof O, O[keyof O]>, obj: O): Partial<O>
  • filter<K, V>(fn: ObjPred<K, V>): <O>(obj: O) => Partial<O>
  • Takes a predicate and a object, and returns a new object containing only members which satisfy the given predicate.

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

    filter(isEven, {a: 1, b: 2, c: 3, d: 4}); //=> {b: 2, d: 4}

    Type parameters

    • O: Record<any, any>

    Parameters

    • fn: ObjPred<keyof O, O[keyof O]>
    • obj: O

    Returns Partial<O>

  • Takes a predicate and a object, and returns a new object containing only members which satisfy the given predicate.

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

    filter(isEven, {a: 1, b: 2, c: 3, d: 4}); //=> {b: 2, d: 4}

    Type parameters

    • K: string

    • V

    Parameters

    Returns <O>(obj: O) => Partial<O>

      • <O>(obj: O): Partial<O>
      • Type parameters

        • O: Record<K, V>

        Parameters

        • obj: O

        Returns Partial<O>

Generated using TypeDoc