UNPKG

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.

22 lines 633 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.arrayCompactMap = void 0; /** * @public * Like _Array.map but where the callback returns null it will be omitted from the result. * * @remarks * See {@link arrayCompactMap}. */ function arrayCompactMap(items, map) { const mapped = []; for (let i = 0, iEnd = items.length; i < iEnd; ++i) { const transformed = map(items[i], i); if (transformed !== null) { mapped.push(transformed); } } return mapped; } exports.arrayCompactMap = arrayCompactMap; //# sourceMappingURL=array-compact-map.js.map