function isPhone(string: string, options:isPhoneOptions = { exact: true }): boolean { const regexBase = '(?:\\+?(\\d{1,3}))?[-. (]*(\\d{3})[-. )]*(\\d{3})[-. ]*(\\d{4})(?: *x(\\d+))?' const indianRegexBase = '(?:(?:\\+|0{0,2})91(\\s*[\\ -]\\s*)?|[0]?)?[789]\\d{9}|(\\d[ -]?){10}\\d' var regExp = options.indian ? options.exact ? new RegExp('^' + indianRegexBase + '$') : new RegExp('\\s*' + indianRegexBase + '\\s*', 'g') : options.exact ? new RegExp('^' + regexBase + '$') : new RegExp('\\s*' + regexBase + '\\s*', 'g') return regExp.test(string) } export default isPhone