|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 11 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
668 bytes
|
| Rev | Line | |
|---|
| [9af201e] | 1 | var baseEach = require('./_baseEach'),
|
|---|
| 2 | isArrayLike = require('./isArrayLike');
|
|---|
| 3 |
|
|---|
| 4 | /**
|
|---|
| 5 | * The base implementation of `_.map` without support for iteratee shorthands.
|
|---|
| 6 | *
|
|---|
| 7 | * @private
|
|---|
| 8 | * @param {Array|Object} collection The collection to iterate over.
|
|---|
| 9 | * @param {Function} iteratee The function invoked per iteration.
|
|---|
| 10 | * @returns {Array} Returns the new mapped array.
|
|---|
| 11 | */
|
|---|
| 12 | function baseMap(collection, iteratee) {
|
|---|
| 13 | var index = -1,
|
|---|
| 14 | result = isArrayLike(collection) ? Array(collection.length) : [];
|
|---|
| 15 |
|
|---|
| 16 | baseEach(collection, function(value, key, collection) {
|
|---|
| 17 | result[++index] = iteratee(value, key, collection);
|
|---|
| 18 | });
|
|---|
| 19 | return result;
|
|---|
| 20 | }
|
|---|
| 21 |
|
|---|
| 22 | module.exports = baseMap;
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.