"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const curry_1 = require("@arrows/composition/curry");
const _aperture_ = (chunkSize, arr) => {
    if (chunkSize <= 0) {
        throw new Error("Chunk size has to be greater than 0.");
    }
    const chunks = [];
    for (let i = 0; i <= arr.length - chunkSize; i++) {
        chunks.push(arr.slice(i, i + chunkSize));
    }
    return chunks;
};
/**
 * Splits the array into overlapping chunks of a provided size (shifted by one).
 *
 * @param chunkSize Chunk size
 * @param arr Initial array
 * @returns New array of chunks
 */
const aperture_ = curry_1.curry(_aperture_);
exports.aperture_ = aperture_;
exports.default = aperture_;
