1 var baseEach = require('./baseEach'),
2 getLength = require('./getLength'),
3 isLength = require('./isLength');
6 * The base implementation of `_.map` without support for callback shorthands
10 * @param {Array|Object|string} collection The collection to iterate over.
11 * @param {Function} iteratee The function invoked per iteration.
12 * @returns {Array} Returns the new mapped array.
14 function baseMap(collection, iteratee) {
16 length = getLength(collection),
17 result = isLength(length) ? Array(length) : [];
19 baseEach(collection, function(value, key, collection) {
20 result[++index] = iteratee(value, key, collection);
25 module.exports = baseMap;