es-toolkit
Version:
A state-of-the-art, high-performance JavaScript utility library with a small bundle size and strong type annotations.
20 lines (15 loc) • 441 B
JavaScript
;
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
const isArrayLike = require('../predicate/isArrayLike.js');
function fromPairs(pairs) {
if (!isArrayLike.isArrayLike(pairs)) {
return {};
}
const result = {};
for (let i = 0; i < pairs.length; i++) {
const [key, value] = pairs[i];
result[key] = value;
}
return result;
}
exports.fromPairs = fromPairs;