Security update for permissions_by_term
[yaffs-website] / node_modules / uncss / node_modules / lodash / fromPairs.js
1 /**
2  * The inverse of `_.toPairs`; this method returns an object composed
3  * from key-value `pairs`.
4  *
5  * @static
6  * @memberOf _
7  * @category Array
8  * @param {Array} pairs The key-value pairs.
9  * @returns {Object} Returns the new object.
10  * @example
11  *
12  * _.fromPairs([['fred', 30], ['barney', 40]]);
13  * // => { 'fred': 30, 'barney': 40 }
14  */
15 function fromPairs(pairs) {
16   var index = -1,
17       length = pairs ? pairs.length : 0,
18       result = {};
19
20   while (++index < length) {
21     var pair = pairs[index];
22     result[pair[0]] = pair[1];
23   }
24   return result;
25 }
26
27 module.exports = fromPairs;