@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.
24 lines • 694 B
JavaScript
/**
* @module Collection
*/
import {} from "../../../../collection/contracts/_module-exports.js";
/**
* @internal
*/
export class ReverseIterable {
collection;
chunkSize;
makeCollection;
constructor(collection, chunkSize, makeCollection) {
this.collection = collection;
this.chunkSize = chunkSize;
this.makeCollection = makeCollection;
}
*[Symbol.iterator]() {
yield* this.collection
.chunk(this.chunkSize)
.map((item) => this.makeCollection([...item].reverse()))
.reduce((collection, item) => collection.prepend(item), this.makeCollection([]));
}
}
//# sourceMappingURL=reverse-iterable.js.map