X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=node_modules%2Fgrunt-legacy-util%2Fnode_modules%2Flodash%2FfromPairs.js;fp=node_modules%2Fgrunt-legacy-util%2Fnode_modules%2Flodash%2FfromPairs.js;h=c18c1e38697b4cffc55db0341fe4cb4071ca7ff2;hb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;hp=0000000000000000000000000000000000000000;hpb=57c063afa3f66b07c4bbddc2d6129a96d90f0aad;p=yaffs-website diff --git a/node_modules/grunt-legacy-util/node_modules/lodash/fromPairs.js b/node_modules/grunt-legacy-util/node_modules/lodash/fromPairs.js new file mode 100644 index 000000000..c18c1e386 --- /dev/null +++ b/node_modules/grunt-legacy-util/node_modules/lodash/fromPairs.js @@ -0,0 +1,27 @@ +/** + * The inverse of `_.toPairs`; this method returns an object composed + * from key-value `pairs`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} pairs The key-value pairs. + * @returns {Object} Returns the new object. + * @example + * + * _.fromPairs([['fred', 30], ['barney', 40]]); + * // => { 'fred': 30, 'barney': 40 } + */ +function fromPairs(pairs) { + var index = -1, + length = pairs ? pairs.length : 0, + result = {}; + + while (++index < length) { + var pair = pairs[index]; + result[pair[0]] = pair[1]; + } + return result; +} + +module.exports = fromPairs;