isValidNumberForRegion_.js 688 B

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