Options
All
  • Public
  • Public/Protected
  • All
Menu

Module array/map

Index

References

Type aliases

Functions

References

Renames and re-exports map

Type aliases

MapFunc<T, R>: (item: T, i: number, arr: ArrayLike<T>) => R

Type parameters

  • T

  • R

Type declaration

    • (item: T, i: number, arr: ArrayLike<T>): R
    • Parameters

      • item: T
      • i: number
      • arr: ArrayLike<T>

      Returns R

Functions

  • map<T, R>(fn: MapFunc<T, R>, arr: ArrayLike<T>): R[]
  • map<T, R>(fn: MapFunc<T, R>): (arr: ArrayLike<T>) => R[]
  • Creates an array of values by running each element in list through fn. The fn is invoked with three arguments: (value, index, arr).

    example
     var double = x => x * 2;

    map(double, [1, 2, 3]); //=> [2, 4, 6]

    Type parameters

    • T

    • R

    Parameters

    • fn: MapFunc<T, R>

      The function to be called on every element of the input list.

    • arr: ArrayLike<T>

      The list to be iterated over.

    Returns R[]

    The new list.

  • Creates an array of values by running each element in list through fn. The fn is invoked with three arguments: (value, index, arr).

    example
     var double = x => x * 2;

    map(double, [1, 2, 3]); //=> [2, 4, 6]

    Type parameters

    • T

    • R

    Parameters

    • fn: MapFunc<T, R>

      The function to be called on every element of the input list.

    Returns (arr: ArrayLike<T>) => R[]

    The new list.

      • (arr: ArrayLike<T>): R[]
      • Parameters

        • arr: ArrayLike<T>

        Returns R[]

Generated using TypeDoc