export function trimKeepingTabs ( text ) { return text . replace ( /(^(\s*[\n\r])+)|([\n\r]+\s*$)/g , '' ) ; } export function isNumeric ( text ) { const mayBeNum = Number ( text ) ; return ! isNaN ( mayBeNum ) && isFinite ( mayBeNum ) ; } export function clamp ( value , min , max ) { if ( min > max ) { [ max , min ] = [ min , max ] ; } return Math . max ( min , Math . min ( value , max ) ) ; }