export type Predicate < T , A > = ( array : T [ ] , ... args : any [ ] ) => A ; export type PrototypePredicate < T , A > = ( ... args : any [ ] ) => A ; export function chain < T , A > ( array , predicate ) { return predicate ( array ) ; } export function inherit ( ) { Array . prototype . chain = function < T , A > ( predicate ) : A { return chain ( this as T [ ] , predicate ) ; } ; } export default chain ;