"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const curry_1 = require("@arrows/composition/curry");
const _zipAll_ = (otherArr, arr) => {
    const length = Math.max(arr.length, otherArr.length);
    const newArr = [];
    for (let i = 0; i < length; i++) {
        const item = [arr[i], otherArr[i]];
        newArr.push(item);
    }
    return newArr;
};
const zipAll_ = curry_1.default(_zipAll_);
const _zip_ = (otherArr, arr) => {
    const length = Math.min(arr.length, otherArr.length);
    const newArr = [];
    for (let i = 0; i < length; i++) {
        const item = [arr[i], otherArr[i]];
        newArr.push(item);
    }
    return newArr;
};
const curriedZip_ = curry_1.default(_zip_);
/**
 * Zips two arrays creating an array of pairs
 * containing values on corresponding indexes.
 * Zips until the length of the shorter array is reached.
 *
 * @param otherArr Array that you want to zip with initial array
 * @param arr Initial array
 * @returns New, zipped array
 *
 * @method all Zips until the length of the longer array is reached
 */
const zip_ = Object.assign(curriedZip_, {
    /**
     * Zips until the length of the longer array is reached.
     *
     * @param otherArr Array that you want to zip with initial array
     * @param arr Initial array
     * @returns New, zipped array
     */
    all: zipAll_,
});
exports.zip_ = zip_;
exports.default = zip_;
