Last change
on this file since 6fe77af was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
556 bytes
|
Line | |
---|
1 | /**
|
---|
2 | * A specialized version of `_.map` for arrays without support for iteratee
|
---|
3 | * shorthands.
|
---|
4 | *
|
---|
5 | * @private
|
---|
6 | * @param {Array} [array] The array to iterate over.
|
---|
7 | * @param {Function} iteratee The function invoked per iteration.
|
---|
8 | * @returns {Array} Returns the new mapped array.
|
---|
9 | */
|
---|
10 | function arrayMap(array, iteratee) {
|
---|
11 | var index = -1,
|
---|
12 | length = array == null ? 0 : array.length,
|
---|
13 | result = Array(length);
|
---|
14 |
|
---|
15 | while (++index < length) {
|
---|
16 | result[index] = iteratee(array[index], index, array);
|
---|
17 | }
|
---|
18 | return result;
|
---|
19 | }
|
---|
20 |
|
---|
21 | module.exports = arrayMap;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.