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.
20 lines • 555 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.arrayMap = void 0;
/**
* @public
* Like `Array.map`.
* @remarks
* Has more consistent performance characteristics cross platform than the built in `Array.map`
*
* See {@link arrayMap}.
*/
function arrayMap(items, callback) {
const mapped = new Array(items.length);
for (let i = 0, iEnd = items.length; i < iEnd; ++i) {
mapped[i] = callback(items[i], i);
}
return mapped;
}
exports.arrayMap = arrayMap;
//# sourceMappingURL=array-map.js.map