MCPcopy
hub / github.com/lodash/lodash / fromPairs

Function fromPairs

lodash.js:7488–7498  ·  view source on GitHub ↗

* 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

(pairs)

Source from the content-addressed store, hash-verified

7486 * // => { 'a': 1, 'b': 2 }
7487 */
7488 function fromPairs(pairs) {
7489 var index = -1,
7490 length = pairs == null ? 0 : pairs.length,
7491 result = {};
7492
7493 while (++index < length) {
7494 var pair = pairs[index];
7495 baseAssignValue(result, pair[0], pair[1]);
7496 }
7497 return result;
7498 }
7499
7500 /**
7501 * Gets the first element of `array`.

Callers

nothing calls this directly

Calls 1

baseAssignValueFunction · 0.85

Tested by

no test coverage detected