Last change
on this file since ceaed42 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
660 bytes
|
Line | |
---|
1 | /**
|
---|
2 | * This base implementation of `_.zipObject` which assigns values using `assignFunc`.
|
---|
3 | *
|
---|
4 | * @private
|
---|
5 | * @param {Array} props The property identifiers.
|
---|
6 | * @param {Array} values The property values.
|
---|
7 | * @param {Function} assignFunc The function to assign values.
|
---|
8 | * @returns {Object} Returns the new object.
|
---|
9 | */
|
---|
10 | function baseZipObject(props, values, assignFunc) {
|
---|
11 | var index = -1,
|
---|
12 | length = props.length,
|
---|
13 | valsLength = values.length,
|
---|
14 | result = {};
|
---|
15 |
|
---|
16 | while (++index < length) {
|
---|
17 | var value = index < valsLength ? values[index] : undefined;
|
---|
18 | assignFunc(result, props[index], value);
|
---|
19 | }
|
---|
20 | return result;
|
---|
21 | }
|
---|
22 |
|
---|
23 | module.exports = baseZipObject;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.