Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

_baseMap.js 668B

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;