UNPKG

@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.

37 lines 896 B
/** * @module Collection */ import {} from "../../../../collection/contracts/_module-exports.js"; /** * @internal */ export class AsyncSliceIterable { collection; start; end; constructor(collection, start, end) { this.collection = collection; this.start = start; this.end = end; } async *[Symbol.asyncIterator]() { const size = await this.collection.size(); let { start, end } = this; if (start === undefined) { start = 0; } if (end === undefined) { end = size; } if (start < 0) { start = size + start; } if (end < 0) { end = size + end; } yield* this.collection.filter((_item, index) => { return start <= index && index < end; }); } } //# sourceMappingURL=async-slice-iterable.js.map