map()

Creates a new array or object with the results of calling a provided function on every item or property in the given object.

This function is valid in v2.19.0 to v2.20.0. This function has been downloaded 4 times.

Parameters

{Array|Object} objectOrArray
The array, array-like structure or object whose items or properties will be traversed by callback.
{Function} callback
Function that produces a replacement item or property for each corresponding one objectOrArray. The first argument passed will be current value of the item or property. The second argument will be the index or property name. The third argument will be a reference to objectOrArray. The return value will be used to replace each item or property.
{*=} opt_thisArg Optional, Default:global
Value to use as this when executing callback.

Returns

{Array|Object}
If objectOrArray is an array-like structure then a new array with the modified contents will be returned. Otherwise a new object with the modified contents will be returned.

Required Functions

This function requires the following functions which are included automatically:

  • isArrayLike()
    Determines if an object is an array or at least array-like.
  • mapKeys()
    Creates a new array or object corresponding to the array-like structure or object supplied where the keys to the new array or object are determined by a callback function.
  • mapPairs()
    Creates a new array or object corresponding to the array-like structure or object supplied where the keys and values to the new array or object are determined by a callback function.