export function parsePhoneNumber ( potentialNumber ) { let phoneRegex = /[+]*[(]{0,1}[0-9]{1,4}[)]{0,1}[-\s.0-9]*/ ; let eightHundredRegex = /0800\s[A-Z]+/ ; if ( potentialNumber === undefined || null ) { return "" ; } else if ( potentialNumber . match ( phoneRegex ) != null && potentialNumber . match ( phoneRegex ) ! [ 0 ] . length > 5 ) { return potentialNumber . match ( phoneRegex ) ! [ 0 ] . trim ( ) ; } else if ( potentialNumber . match ( eightHundredRegex ) != null ) { return potentialNumber . match ( eightHundredRegex ) ! [ 0 ] . trim ( ) ; } else { return potentialNumber ; } }