Options
All
  • Public
  • Public/Protected
  • All
Menu

Module array/update

Index

References

Functions

References

Renames and re-exports update

Functions

  • update<T>(index: number, value: T, list: ArrayLike<T>): T[]
  • update<T>(index: number, value: T): (list: ArrayLike<T>) => T[]
  • update<T>(index: number): { <T>(value: T, list: ArrayLike<T>): T[]; <T>(value: T): (list: ArrayLike<T>) => T[] }
  • Returns a new copy of the array with the element at the provided index replaced with the given value.

    example
     update(1, 11, [0, 1, 2]);     //=> [0, 11, 2]
    update(1)(11)([0, 1, 2]); //=> [0, 11, 2]

    Type parameters

    • T

    Parameters

    • index: number
    • value: T
    • list: ArrayLike<T>

      The source array to be updated.

    Returns T[]

    A copy of list with the value at index idx replaced with x.

  • Returns a new copy of the array with the element at the provided index replaced with the given value.

    example
     update(1, 11, [0, 1, 2]);     //=> [0, 11, 2]
    update(1)(11)([0, 1, 2]); //=> [0, 11, 2]

    Type parameters

    • T

    Parameters

    • index: number
    • value: T

    Returns (list: ArrayLike<T>) => T[]

    A copy of list with the value at index idx replaced with x.

      • (list: ArrayLike<T>): T[]
      • Parameters

        • list: ArrayLike<T>

        Returns T[]

  • Returns a new copy of the array with the element at the provided index replaced with the given value.

    example
     update(1, 11, [0, 1, 2]);     //=> [0, 11, 2]
    update(1)(11)([0, 1, 2]); //=> [0, 11, 2]

    Type parameters

    • T

    Parameters

    • index: number

    Returns { <T>(value: T, list: ArrayLike<T>): T[]; <T>(value: T): (list: ArrayLike<T>) => T[] }

    A copy of list with the value at index idx replaced with x.

      • <T>(value: T, list: ArrayLike<T>): T[]
      • <T>(value: T): (list: ArrayLike<T>) => T[]
      • Type parameters

        • T

        Parameters

        • value: T
        • list: ArrayLike<T>

        Returns T[]

      • Type parameters

        • T

        Parameters

        • value: T

        Returns (list: ArrayLike<T>) => T[]

          • (list: ArrayLike<T>): T[]
          • Parameters

            • list: ArrayLike<T>

            Returns T[]

Generated using TypeDoc