mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-31 15:27:50 +00:00
22 lines
608 B
JavaScript
22 lines
608 B
JavaScript
define(['./baseEach'], function(baseEach) {
|
|
|
|
/**
|
|
* The base implementation of `_.map` without support for callback shorthands
|
|
* or `this` binding.
|
|
*
|
|
* @private
|
|
* @param {Array|Object|string} collection The collection to iterate over.
|
|
* @param {Function} iteratee The function invoked per iteration.
|
|
* @returns {Array} Returns the new mapped array.
|
|
*/
|
|
function baseMap(collection, iteratee) {
|
|
var result = [];
|
|
baseEach(collection, function(value, key, collection) {
|
|
result.push(iteratee(value, key, collection));
|
|
});
|
|
return result;
|
|
}
|
|
|
|
return baseMap;
|
|
});
|