@daiso-tech/core
Version:
The library offers flexible, framework-agnostic solutions for modern web applications, built on adaptable components that integrate seamlessly with popular frameworks like Next Js.
29 lines • 828 B
JavaScript
/**
* @module Collection
*/
import {} from "../../../../collection/contracts/_module-exports.js";
import { resolveInvokable } from "../../../../utilities/_module-exports.js";
/**
* @internal
*/
export class ChangeIterable {
collection;
predicateFn;
mapFn;
constructor(collection, predicateFn, mapFn) {
this.collection = collection;
this.predicateFn = predicateFn;
this.mapFn = mapFn;
}
*[Symbol.iterator]() {
for (const [index, item] of this.collection.entries()) {
if (resolveInvokable(this.predicateFn)(item, index, this.collection)) {
yield resolveInvokable(this.mapFn)(item, index, this.collection);
}
else {
yield item;
}
}
}
}
//# sourceMappingURL=update-iterable.js.map