@beenotung/tslib
Version:
utils library in Typescript
17 lines (16 loc) • 388 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.mapIterableToArray = mapIterableToArray;
/**
* like Array.from(xs).map(f)
* but more performant by performing the lookup in one-pass
* */
function mapIterableToArray(xs, f) {
const res = [];
let i = 0;
for (const x of xs) {
res.push(f(x, i));
i++;
}
return res;
}