mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-31 15:27:50 +00:00
21 lines
574 B
JavaScript
21 lines
574 B
JavaScript
var baseEach = require('./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;
|
|
}
|
|
|
|
module.exports = baseMap;
|