UNPKG

ts-prime

Version:

A utility library for JavaScript and Typescript.

15 lines (14 loc) 453 B
import { purry } from './purry'; export function flatMapToObj() { return purry(_flatMapToObj(), arguments); } var _flatMapToObj = function () { return function (array, fn) { return array.reduce(function (result, element, index) { var items = fn(element, index, array); items.forEach(function (_a) { var key = _a[0], value = _a[1]; result[key] = value; }); return result; }, {}); }; };