• Create a subset of a stream, based on a filter function (like Array.filter)

    The filter function receives the current index (zero-based) as well as the current value. If it returns truth, the value will be passed to the output, otherwise it will be skipped.

    If the filter function is typed as a Typescript type guard (i.e. as returning v is SomeType), then the resulting source will be typed as Source.

    Type Parameters

    • T
    • R

    Parameters

    • filter: ((v: T, idx: number) => v is R)
        • (v: T, idx: number): v is R
        • Parameters

          • v: T
          • idx: number

          Returns v is R

    Returns Transformer<T, R>

  • Type Parameters

    • T

    Parameters

    • filter: ((v: T, idx: number) => boolean)
        • (v: T, idx: number): boolean
        • Parameters

          • v: T
          • idx: number

          Returns boolean

    Returns Transformer<T>