"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const curry_1 = require("@arrows/composition/curry");
const lastIndexOfAll = (element, arr) => arr.lastIndexOf(element);
const _lastIndexOf = (element, fromIndex, arr) => arr.lastIndexOf(element, fromIndex);
const curriedLastIndexOf = curry_1.default(_lastIndexOf);
/**
 * Functional wrapper for Array.prototype.lastIndexOf
 *
 * Retrieves the index of the last occurrence of a specified value in an array.
 * The array is searched backwards, starting at fromIndex.
 *
 * @param element The value to locate in the array
 * @param fromIndex The array index at which to begin the search
 * @param arr Initial array
 * @returns Index of the matching element or -1
 *
 * @method all Version with implicit fromIndex (arr.length - 1)
 */
const lastIndexOf = Object.assign(curriedLastIndexOf, {
    /**
     * Version with implicit fromIndex (arr.length - 1).
     *
     * @param element The value to locate in the array
     * @param arr Initial array
     * @returns Index of the matching element or -1
     */
    all: curry_1.default(lastIndexOfAll),
});
exports.lastIndexOf = lastIndexOf;
exports.default = lastIndexOf;
