import { curry } from '@typed/lambda' import { equals } from '@typed/logic' import { Maybe } from '@typed/maybe' import { findLastIndex } from '../findLastIndex' /** * Find the last index of a given value in a list * @param value :: a * @param list :: [a] * @returns Maybe number */ export const lastIndexOf = curry(__lastIndexOf) as { (value: A, list: ArrayLike): Maybe (value: A): (list: ArrayLike) => Maybe } function __lastIndexOf(value: A, list: ArrayLike): Maybe { return findLastIndex(equals(value), list) }