iter-fns - v0.13.0
    Preparing search index...

    Function span

    • Splits an iterable into the longest prefix where the predicate matches, then the remainder of the iterable.

      Type Parameters

      • T

        type of the item

      • S

      Parameters

      • iterable: Iterable<T>

        the iterable

      • p: (x: T, i: number) => x is S

        the predicate

      Returns [S[], T[]]

    • Splits an iterable into the longest prefix where the predicate matches, then the remainder of the iterable.

      Type Parameters

      • T

        type of the item

      Parameters

      • iterable: Iterable<T>

        the iterable

      • p: (x: T, i: number) => boolean

        the predicate

      Returns [T[], T[]]