format export function parseFlipperPorts ( envVar ) { const components = envVar . split ( ',' ) ; const ports = components . map ( ( x ) => parseInt ( x , 10 ) ) ; if ( ports . length === 2 && components . every ( ( x ) => /^\d+$/ . test ( x ) ) && ports . every ( ( x ) => x > 0 ) ) { return { insecure : ports [ 0 ] , secure : ports [ 1 ] , } ; } } export function parseEnvironmentVariableAsNumber ( envVarName , defaultValue ? ) { const envVarAsString = process . env [ envVarName ] ; if ( envVarAsString ) { const parsedInt = parseInt ( envVarAsString , 10 ) ; return isNaN ( parsedInt ) ? defaultValue : parsedInt ; } return defaultValue ; }