sequency
Version:
Functional sequences for processing iterable data in JavaScript
19 lines • 703 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.ForEachIndexed = void 0;
var ForEachIndexed = /** @class */ (function () {
function ForEachIndexed() {
}
/**
* Performs the given `action` (side-effect) for each element of the sequence and passes the `index` of the current
* element (zero-based).
*
* @param {(index: number, value: T) => void} action
*/
ForEachIndexed.prototype.forEachIndexed = function (action) {
this.withIndex()
.forEach(function (it) { return action(it.index, it.value); });
};
return ForEachIndexed;
}());
exports.ForEachIndexed = ForEachIndexed;
//# sourceMappingURL=forEachIndexed.js.map