@segment/analytics.js-core
Version:
The hassle-free way to integrate analytics into any web application.
19 lines (18 loc) • 658 B
TypeScript
export = map;
/**
* Produce a new array by passing each value in the input `collection` through a transformative
* `iterator` function. The `iterator` function is passed three arguments:
* `(value, index, collection)`.
*
* @name map
* @api public
* @param {Function} iterator The transformer function to invoke per iteration.
* @param {Array} collection The collection to iterate over.
* @return {Array} A new array containing the results of each `iterator` invocation.
* @example
* var square = function(x) { return x * x; };
*
* map(square, [1, 2, 3]);
* //=> [1, 4, 9]
*/
declare function map(iterator: Function, collection: any[]): any[];