Function filter

  • creates a new sequence with every item of the source sequence for which the predicate function returns a truthy/falsy value, optionally narrowing the type of the returned iterable (if a type-guard predicate is supplied)

    Remarks

    deferred version of _filter

    Returns

    a new (possibly shorter) sequence with some items filtered away. If a type-guard (i.e. function returns something like val is S) is supplied for pred, then the resulting sequence will be narrowed to Iterable<S>

    Type Parameters

    • T

    • S

    Parameters

    • pred: TypeGuardPredicate<T, S>

      a function that returns a truthy value to signal inclusion or a falsy value to exclude. Alternatively a type-guard function can be supplied

    Returns ((src: Iterable<T>) => Iterable<S>)

      • (src: Iterable<T>): Iterable<S>
      • Parameters

        • src: Iterable<T>

        Returns Iterable<S>

  • Type Parameters

    • T

    Parameters

    Returns ((src: Iterable<T>) => Iterable<T>)

      • (src: Iterable<T>): Iterable<T>
      • Parameters

        • src: Iterable<T>

        Returns Iterable<T>

Generated using TypeDoc