Files
lodash/internal/baseMap.js
John-David Dalton f9606b394c Bump to v3.0.0.
2015-02-04 00:38:56 -08:00

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;