import getClosestPoint from './getClosestPoint' ; import getPrecision from './getPrecision' ; import type PropsType from '../PropsType' ; export default function ensureValuePrecision ( val , props ) { const { step } = props ; const closestPoint = Number . isFinite ( getClosestPoint ( val , props ) ) ? getClosestPoint ( val , props ) : 0 ; return step === null ? closestPoint : parseFloat ( closestPoint . toFixed ( getPrecision ( step ) ) ) ; }