import type { RoundingMethod } from '../../types' ; type RoundingFn = typeof Math . round ; type RoundingFnsMap = { [ method in RoundingMethod ] : RoundingFn ; } ; const roundingMap = { ceil : Math . ceil , round : Math . round , floor : Math . floor , trunc : ( value ) => ( value < 0 ? Math . ceil ( value ) : Math . floor ( value ) ) , } ; const defaultRoundingMethod = 'trunc' ; export function getRoundingMethod ( method ) { return method ? roundingMap [ method ] : roundingMap [ defaultRoundingMethod ] ; }