UNPKG

ts-prime

Version:

A utility library for JavaScript and Typescript.

12 lines (11 loc) 368 B
import { purry } from './purry'; export function mapToObj() { return purry(_mapToObj(), arguments); } var _mapToObj = function () { return function (array, fn) { return array.reduce(function (result, element, index) { var _a = fn(element, index, array), key = _a[0], value = _a[1]; result[key] = value; return result; }, {}); }; };