@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 • 839 B
JavaScript
/**
* @module Collection
*/
import {} from "../../../../collection/contracts/_module-exports.js";
import { resolveInvokable } from "../../../../utilities/_module-exports.js";
/**
* @internal
*/
export class AsyncSkipUntilIterable {
collection;
predicateFn;
constructor(collection, predicateFn) {
this.collection = collection;
this.predicateFn = predicateFn;
}
async *[Symbol.asyncIterator]() {
let hasMatched = false, index = 0;
for await (const item of this.collection) {
if (!hasMatched) {
hasMatched = await resolveInvokable(this.predicateFn)(item, index, this.collection);
}
if (hasMatched) {
yield item;
}
index++;
}
}
}
//# sourceMappingURL=async-skip-until-iterable.js.map