1 | import isValidNumber from './validate_'
|
2 |
|
3 | /**
|
4 | * Checks if a given phone number is valid within a given region.
|
5 | * Is just an alias for `phoneNumber.isValid() && phoneNumber.country === country`.
|
6 | * https://github.com/googlei18n/libphonenumber/blob/master/FAQ.md#when-should-i-use-isvalidnumberforregion
|
7 | */
|
8 | export default function isValidNumberForRegion(input, country, options, metadata) {
|
9 | // If assigning the `{}` default value is moved to the arguments above,
|
10 | // code coverage would decrease for some weird reason.
|
11 | options = options || {}
|
12 | return input.country === country && isValidNumber(input, options, metadata)
|
13 | } |
\ | No newline at end of file |