UNPKG

es-toolkit

Version:

A state-of-the-art, high-performance JavaScript utility library with a small bundle size and strong type annotations.

16 lines (13 loc) 331 B
import { isArrayLike } from '../predicate/isArrayLike.mjs'; function fromPairs(pairs) { if (!isArrayLike(pairs)) { return {}; } const result = {}; for (let i = 0; i < pairs.length; i++) { const [key, value] = pairs[i]; result[key] = value; } return result; } export { fromPairs };