import isDDD from './isDDD' ; /**
 * Pattern for common brazilian telephone number formats, optionally with DDI,
 * DDD and the ninth digit.
 */ const PHONE_PATTERN = /^(\+55)? ?\(?(\d{2})?\)? ?9? ?\d{4}[-| ]?\d{4}$/ ; example param value const isPhone = ( value ) : boolean => { if ( ! PHONE_PATTERN . test ( value ) ) return false ; const [ , , DDD ] = PHONE_PATTERN . exec ( value ) ! ; return DDD ? isDDD ( DDD ) : true ; } ; export default isPhone ;