Skip to content
This repository was archived by the owner on Oct 20, 2021. It is now read-only.

Latest commit

 

History

History
30 lines (23 loc) · 642 Bytes

country-code.md

File metadata and controls

30 lines (23 loc) · 642 Bytes

CountryCode

Validates an ISO country code.

Valid values:

validator.countryCode().validate('BR');
validator.countryCode('alpha-2').validate('BR');
validator.countryCode('alpha-3').validate('BRA');
validator.countryCode('numeric').validate('076');
validator.countryCode('name').validate('Brazil');

Invalid values:

validator.countryCode().validate('foo');
validator.countryCode('alpha-2').validate('076');
validator.countryCode('alpha-3').validate('BR');
validator.countryCode('numeric').validate('BRA');
validator.countryCode('name').validate('foobar');

You can choose between:

  • alpha-2
  • alpha-3
  • numeric
  • name