br-phone-validator-lib
Version:
Cell number and fixed phone number validator lib
32 lines (25 loc) • 999 B
Markdown
# Br-Phone-Validator-Lib
Cell number and fixed phone number validator
[](https://travis-ci.com/idylicaro/Br-Phone-Validator-Lib)
---
Valid for these formats:
```
`(xx) xxxxx-xxxx` or
`(xx) xxxx-xxxx` or
`xxxxxxxxxxx` or
`xxxxxxxxxx` or
```
## Install
```
npm i br-phone-validator-lib
```
## Usage
```typescript
import PhoneBrValidator from 'br-phone-validator-lib'
PhoneBrValidator.isPhone('(79) 99212-2212') // return true
PhoneBrValidator.isPhone('(79) 9212-2212') // return false because first number after DDD in number fixed should not is 0 or 1 or 9
PhoneBrValidator.isPhone('(79) 3212-2212') // return true
PhoneBrValidator.isPhone('79992122212') // return true
PhoneBrValidator.isPhone('7992122212') // return false because first number after DDD in number fixed should not is 0 or 1 or 9
PhoneBrValidator.isPhone('7932122212') // return true
```