Interface ExtendedIterable<T>

An iterable with additional methods.

Type Parameters

  • T

Hierarchy

  • Iterable<T>
    • ExtendedIterable

Properties

async: (() => ExtendedAsyncIterable<Awaited<T>>)

Type declaration

at: ((n: number) => undefined | T)

Type declaration

    • (n: number): undefined | T
    • Returns the nth element of the iterable.

      Returns

      The nth element of the iterable, or undefined if the iterable is shorter than n + 1 elements.

      Parameters

      • n: number

        The index of the element to return.

      Returns undefined | T

concat: ((...iterables: (ExtendedIterable<T> | Iterable<T>)[]) => ExtendedIterable<T>)

Type declaration

    • (...iterables: (ExtendedIterable<T> | Iterable<T>)[]): ExtendedIterable<T>
    • Creates an iterable by concatenating an arbitrary number of iterables with the current iterable.

      Returns

      An iterable containing the elements of the current iterable followed by the elements of the provided iterables.

      Parameters

      • Rest ...iterables: (ExtendedIterable<T> | Iterable<T>)[]

        The iterables to concatenate.

      Returns ExtendedIterable<T>

consume: (<U>(mapFn?: MapFn<T, U>) => U[])

Type declaration

    • <U>(mapFn?: MapFn<T, U>): U[]
    • Fully consumes the iterable while passing each value to the provided callback. The values returned from calling the callback function are returned as an array.

      Returns

      An array containing the values returned from calling the callback function.

      Type Parameters

      • U

      Parameters

      • Optional mapFn: MapFn<T, U>

        A callback function that receives the current value and index of the iterable.

      Returns U[]

every: ((predicate: ArrayLikePredicate<T>) => boolean)

Type declaration

    • (predicate: ArrayLikePredicate<T>): boolean
    • Tests whether all values of the iterable satisfy the provided predicate.

      Returns

      true if all values of the iterable satisfy the provided predicate, otherwise false.

      Parameters

      • predicate: ArrayLikePredicate<T>

        A predicate function that receives the current value and index of the iterable.

      Returns boolean

filter: ((predicate: ArrayLikePredicate<T>) => ExtendedIterable<T>)

Type declaration

find: ((predicate: ArrayLikePredicate<T>) => undefined | T)

Type declaration

first: ((predicate?: ArrayLikePredicate<T>) => ExtendedIterable<T>)

Type declaration

forEach: ((fn: ((element: T, index: number) => void)) => ExtendedIterable<T>)

Type declaration

    • (fn: ((element: T, index: number) => void)): ExtendedIterable<T>
    • Parameters

      • fn: ((element: T, index: number) => void)
          • (element: T, index: number): void
          • Parameters

            • element: T
            • index: number

            Returns void

      Returns ExtendedIterable<T>

getIterator: (() => Iterator<T, any, undefined>)

Type declaration

    • (): Iterator<T, any, undefined>
    • Returns Iterator<T, any, undefined>

isEmpty: (() => boolean)

Type declaration

    • (): boolean
    • Returns boolean

map: (<U>(mapFn: MapFn<T, U>) => ExtendedIterable<U>)

Type declaration

reduce: (<U>(reducer: Reducer<T, U>, initialValue?: U) => U)

Type declaration

    • <U>(reducer: Reducer<T, U>, initialValue?: U): U
    • Type Parameters

      • U = T

      Parameters

      • reducer: Reducer<T, U>
      • Optional initialValue: U

      Returns U

scan: (<U>(reducer: Reducer<T, U>, initialValue?: U) => ExtendedIterable<U>)

Type declaration

slice: ((startIndex: number, endIndex?: number) => ExtendedIterable<T>)

Type declaration

some: ((predicate: ArrayLikePredicate<T>) => boolean)

Type declaration

take: ((n: number) => ExtendedIterable<T>)

Type declaration

toArray: (() => T[])

Type declaration

    • (): T[]
    • Returns T[]

Methods

  • Returns Iterator<T, any, undefined>

Generated using TypeDoc