Security update for permissions_by_term
[yaffs-website] / node_modules / uncss / node_modules / lodash / zipObject.js
1 var baseSet = require('./internal/baseSet');
2
3 /**
4  * This method is like `_.fromPairs` except that it accepts two arrays,
5  * one of property names and one of corresponding values.
6  *
7  * @static
8  * @memberOf _
9  * @category Array
10  * @param {Array} [props=[]] The property names.
11  * @param {Array} [values=[]] The property values.
12  * @returns {Object} Returns the new object.
13  * @example
14  *
15  * _.zipObject(['fred', 'barney'], [30, 40]);
16  * // => { 'fred': 30, 'barney': 40 }
17  */
18 function zipObject(props, values) {
19   var index = -1,
20       length = props ? props.length : 0,
21       valsLength = values ? values.length : 0,
22       result = {};
23
24   while (++index < length) {
25     baseSet(result, props[index], index < valsLength ? values[index] : undefined);
26   }
27   return result;
28 }
29
30 module.exports = zipObject;