import type { Calculator } from '../types' ; import { lessThan } from './lessThan' ; type MaximumCalculator < TAmount > = Calculator < TAmount > ; param calculator returns export function maximum < TAmount > ( calculator ) { const lessThanFn = lessThan ( calculator ) ; return ( values ) => { return values . reduce ( ( acc , curr ) => { return lessThanFn ( acc , curr ) ? curr : acc ; } ) ; } ; }