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.
16 lines • 429 B
JavaScript
/**
* @public
* Like `Array.map`.
* @remarks
* Has more consistent performance characteristics cross platform than the built in `Array.map`
*
* See {@link arrayMap}.
*/
export 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;
}
//# sourceMappingURL=array-map.js.map