5dacabd9f40c4d0b51c5cd381b3177d45ed63c617eda9f113be90130f76408140f823084aad9524c30e52149be3a2d221518a84f6de3e549f72e4690135d88 666 B

12345678910111213141516171819202122
  1. import baseEach from './_baseEach.js';
  2. import isArrayLike from './isArrayLike.js';
  3. /**
  4. * The base implementation of `_.map` without support for iteratee shorthands.
  5. *
  6. * @private
  7. * @param {Array|Object} collection The collection to iterate over.
  8. * @param {Function} iteratee The function invoked per iteration.
  9. * @returns {Array} Returns the new mapped array.
  10. */
  11. function baseMap(collection, iteratee) {
  12. var index = -1,
  13. result = isArrayLike(collection) ? Array(collection.length) : [];
  14. baseEach(collection, function(value, key, collection) {
  15. result[++index] = iteratee(value, key, collection);
  16. });
  17. return result;
  18. }
  19. export default baseMap;