export function isEmptyObj ( value ) { return typeof value === 'object' && Object . keys ( value ) . length === 0 ; } export function isNumber ( value ) { return typeof value === 'number' ; } export function toNumber ( value , defaultValue ? ) { if ( ! value ) { if ( defaultValue ) return defaultValue ; } if ( isNumber ( value ) ) return value as number ; const num = Number ( value ) ; if ( isNumber ( num ) ) return num ; return 0 ; }