UNPKG

rc-js-util

Version:

A collection of TS and C++ utilities to help writing performant and correct applications, achieved through strict typing and (removable) invariant checking.

19 lines 630 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.dictionaryCollect = void 0; /** * @public * Like `Array.reduce` but for dictionaries and without the requirement to return the value in the callback. * * @remarks * See {@link dictionaryCollect}. */ function dictionaryCollect(items, collected, collect, keys = Object.keys(items)) { for (let i = 0, iEnd = keys.length; i < iEnd; ++i) { const key = keys[i]; collect(collected, items[key], key, i); } return collected; } exports.dictionaryCollect = dictionaryCollect; //# sourceMappingURL=dictionary-collect.js.map