@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.
22 lines • 573 B
JavaScript
/**
* @module Collection
*/
import {} from "../../../../collection/contracts/_module-exports.js";
/**
* @internal
*/
export class AsyncTakeIterable {
collection;
limit;
constructor(collection, limit) {
this.collection = collection;
this.limit = limit;
}
async *[Symbol.asyncIterator]() {
if (this.limit < 0) {
this.limit = (await this.collection.size()) + this.limit;
}
yield* this.collection.takeWhile((_item, index) => index < this.limit);
}
}
//# sourceMappingURL=async-take-iterable.js.map