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 • 530 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.mapArrayMap = void 0;
/**
* @public
* Like `Array.map` but with a `Map` input. Outputs an `Array`.
*
* @returns An array of mapped values.
*
* @remarks
* See {@link mapArrayMap}.
*/
function mapArrayMap(map, callback) {
const mapped = new Array(map.size);
let index = 0;
map.forEach((v, k) => mapped[index++] = callback(v, k));
return mapped;
}
exports.mapArrayMap = mapArrayMap;
//# sourceMappingURL=map-array-map.js.map