UNPKG

@beenotung/tslib

Version:
17 lines (16 loc) 388 B
"use strict"; 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; }