Options
All
  • Public
  • Public/Protected
  • All
Menu

Module iterable/slice

Index

Functions

Functions

  • slice<T>(from: number, to: number, arr: readonly T[]): Iterable<T>
  • slice<T>(from: number, to: number): (arr: readonly T[]) => Iterable<T>
  • slice<T>(from: number): CurriedFunction2<number, readonly T[], Iterable<T>>
  • Returns an iterable slice of the array, with the same semantics as array.slice().

    example
     slice(1, 3, ['a', 'b', 'c', 'd']);        //=> Iterable<['b', 'c']>
    slice(1, Infinity, ['a', 'b', 'c', 'd']); //=> Iterable<['b', 'c', 'd']>
    slice(0, -1, ['a', 'b', 'c', 'd']); //=> Iterable<['a', 'b', 'c']>
    slice(-3, -1, ['a', 'b', 'c', 'd']); //=> Iterable<['b', 'c']>

    Type parameters

    • T

    Parameters

    • from: number

      The start index (inclusive).

    • to: number

      The end index (exclusive).

    • arr: readonly T[]

    Returns Iterable<T>

  • Returns an iterable slice of the array, with the same semantics as array.slice().

    example
     slice(1, 3, ['a', 'b', 'c', 'd']);        //=> Iterable<['b', 'c']>
    slice(1, Infinity, ['a', 'b', 'c', 'd']); //=> Iterable<['b', 'c', 'd']>
    slice(0, -1, ['a', 'b', 'c', 'd']); //=> Iterable<['a', 'b', 'c']>
    slice(-3, -1, ['a', 'b', 'c', 'd']); //=> Iterable<['b', 'c']>

    Type parameters

    • T

    Parameters

    • from: number

      The start index (inclusive).

    • to: number

      The end index (exclusive).

    Returns (arr: readonly T[]) => Iterable<T>

      • (arr: readonly T[]): Iterable<T>
      • Parameters

        • arr: readonly T[]

        Returns Iterable<T>

  • Returns an iterable slice of the array, with the same semantics as array.slice().

    example
     slice(1, 3, ['a', 'b', 'c', 'd']);        //=> Iterable<['b', 'c']>
    slice(1, Infinity, ['a', 'b', 'c', 'd']); //=> Iterable<['b', 'c', 'd']>
    slice(0, -1, ['a', 'b', 'c', 'd']); //=> Iterable<['a', 'b', 'c']>
    slice(-3, -1, ['a', 'b', 'c', 'd']); //=> Iterable<['b', 'c']>

    Type parameters

    • T

    Parameters

    • from: number

      The start index (inclusive).

    Returns CurriedFunction2<number, readonly T[], Iterable<T>>

Generated using TypeDoc