1 var baseSet = require('./internal/baseSet');
4 * This method is like `_.fromPairs` except that it accepts two arrays,
5 * one of property names and one of corresponding values.
10 * @param {Array} [props=[]] The property names.
11 * @param {Array} [values=[]] The property values.
12 * @returns {Object} Returns the new object.
15 * _.zipObject(['fred', 'barney'], [30, 40]);
16 * // => { 'fred': 30, 'barney': 40 }
18 function zipObject(props, values) {
20 length = props ? props.length : 0,
21 valsLength = values ? values.length : 0,
24 while (++index < length) {
25 baseSet(result, props[index], index < valsLength ? values[index] : undefined);
30 module.exports = zipObject;