/
githubmirror
/
lodash
Обзор
Документация
Войти
/
githubmirror
/
lodash
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
4.18.0-amd
_baseMap.js
22 строки
688 B
John-David Dalton
Bump to v4.1.0.
29 янв 2016, 12:14
29 янв 2016, 12:14
7293d39
Код
Авторство
О чём код?
define(['./_baseEach', './isArrayLike'], function(baseEach, isArrayLike) { /** * The base implementation of `_.map` without support for iteratee shorthands. * * @private * @param {Array|Object} 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 index = -1, result = isArrayLike(collection) ? Array(collection.length) : []; baseEach(collection, function(value, key, collection) { result[++index] = iteratee(value, key, collection); }); return result; } return baseMap; });