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.
18 lines • 517 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.arrayCollect = void 0;
/**
* @public
* Like `Array.reduce` but without the requirement to return the value in the callback.
*
* @remarks
* See {@link arrayCollect}.
*/
function arrayCollect(items, collected, collect) {
for (let i = 0, iEnd = items.length; i < iEnd; ++i) {
collect(collected, items[i], i);
}
return collected;
}
exports.arrayCollect = arrayCollect;
//# sourceMappingURL=array-collect.js.map