COLLECTED BY
Organization:
Internet Archive
Focused crawls are collections of frequently-updated webcrawl data from narrow (as opposed to broad or wide) web crawls, often focused on a single domain or subdomain.
The Wayback Machine - https://web.archive.org/web/20201220221631/https://github.com/lodash/lodash/blob/master/map.js
Permalink
Cannot retrieve contributors at this time
30 lines (28 sloc)
736 Bytes
/**
* Creates an array of values by running each element of `array` thru `iteratee`.
* The iteratee is invoked with three arguments: (value, index, array).
*
* @since 5.0.0
* @category Array
* @param {Array } array The array to iterate over.
* @param {Function } iteratee The function invoked per iteration.
* @returns {Array } Returns the new mapped array.
* @example
*
* function square(n) {
* return n * n
* }
*
* map([4, 8], square)
* // => [16, 64]
*/
function map ( array , iteratee ) {
let index = - 1
const length = array == null ? 0 : array . length
const result = new Array ( length )
while ( ++ index < length ) {
result [ index ] = iteratee ( array [ index ] , index , array )
}
return result
}
export default map
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session.
You signed out in another tab or window. Reload to refresh your session.