Permalink
Cannot retrieve contributors at this time
28 lines (26 sloc)
596 Bytes
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
codeql-action/node_modules/lodash/fromPairs.js
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* The inverse of `_.toPairs`; this method returns an object composed | |
* from key-value `pairs`. | |
* | |
* @static | |
* @memberOf _ | |
* @since 4.0.0 | |
* @category Array | |
* @param {Array} pairs The key-value pairs. | |
* @returns {Object} Returns the new object. | |
* @example | |
* | |
* _.fromPairs([['a', 1], ['b', 2]]); | |
* // => { 'a': 1, 'b': 2 } | |
*/ | |
function fromPairs(pairs) { | |
var index = -1, | |
length = pairs == null ? 0 : pairs.length, | |
result = {}; | |
while (++index < length) { | |
var pair = pairs[index]; | |
result[pair[0]] = pair[1]; | |
} | |
return result; | |
} | |
module.exports = fromPairs; |