import { Hundred } from '../const' ; export const validPercent = ( max , n ) => Math . round ( Math . max ( Math . min ( Hundred , n ) , 0 ) * max / Hundred ) ; export const validNum = ( max , n ) => Math . max ( Math . min ( max , Math . round ( n ) ) , 0 ) ; export const valid = ( isPercent , max , n ) => isPercent ? validPercent ( max , + n ) : validNum ( max , + n ) ; export const validOpacity = ( p , n ) => Math . max ( Math . min ( 1 , p ? + n / Hundred : + n ) , 0 ) ;