UNPKG

sequency

Version:

Functional sequences for processing iterable data in JavaScript

20 lines 737 B
Object.defineProperty(exports, "__esModule", { value: true }); exports.FilterIndexed = void 0; var FilterIndexed = /** @class */ (function () { function FilterIndexed() { } /** * Returns a new sequence consisting of all elements that match the given `predicate`. * * @param {(index: number, value: T) => boolean} predicate * @returns {Sequence<T>} */ FilterIndexed.prototype.filterIndexed = function (predicate) { return this.withIndex() .filter(function (it) { return predicate(it.index, it.value); }) .map(function (it) { return it.value; }); }; return FilterIndexed; }()); exports.FilterIndexed = FilterIndexed; //# sourceMappingURL=filterIndexed.js.map