Repositorio del curso CCOM4030 el semestre B91 del proyecto Artesanías con el Instituto de Cultura

12345678910111213141516171819202122
  1. var baseEach = require('./_baseEach'),
  2. isArrayLike = require('./isArrayLike');
  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. module.exports = baseMap;