import type { Calculator } from '../types' ; import { greaterThan } from './greaterThan' ; type MinimumCalculator < TAmount > = Calculator < TAmount > ; param calculator returns export function minimum < TAmount > ( calculator ) { const greaterThanFn = greaterThan ( calculator ) ; return ( values ) => { return values . reduce ( ( acc , curr ) => { return greaterThanFn ( acc , curr ) ? curr : acc ; } ) ; } ; }