import { Index , List } from '../types' ; import { Maybe , map } from '@typed/maybe' ; import { curry2 } from '@typed/functions' ; import { findLastIndex } from '../findLastIndex' ; name export const findLast = curry2 ( __findLast ) ; export type FindLast = { < A > ( predicate , list ) : Maybe < A > ; < A > ( predicate ) : ( list : List < A > ) => Maybe < A > ; } ; const propFlipped = < A > ( list ) => ( index ) : A => list [ index ] ; function __findLast < A > ( predicate , list ) { return map ( propFlipped ( list ) , findLastIndex ( predicate , list ) ) ; }