# new Country(options)
Parameters:
Name | Type | Description |
---|---|---|
options |
Object
|
a set of properties to govern how this instance is constructed. |
Methods
# getCode(ctryname) → {string}
Return the country code corresponding to the country name given. If the country name is given, but it is not found in the list of known countries, this method will throw an exception.
Parameters:
Name | Type | Description |
---|---|---|
ctryname |
string
|
The country name in the language of the locale of this instance |
"Country xx is unknown" when the given country name is not in the list of known country names. xx is replaced with the requested country name.
the country code corresponding to the country name
string
# getLocale() → {Locale}
Return the locale for this country. If the options to the constructor included a locale property in order to find the country that is appropriate for that locale, then the locale is returned here. If the options did not include a locale, then this method returns undefined.
the locale used in the constructor of this instance, or undefined if no locale was given in the constructor
# getName(code) → {string}
Return the country name corresponding to the country code given. If the code is given, but it is not found in the list of known countries, this method will throw an exception.
Parameters:
Name | Type | Description |
---|---|---|
code |
string
|
The country code to get the country name |
"Country xx is unknown" when the given country code is not in the list of known country codes. xx is replaced with the requested country code.
the country name in the language of the locale of this instance
string
# static getAvailableCode() → {Object}
Return an array of the ids for all ISO 3166-1 alpha-2 code that this copy of ilib knows about.
an object of country code that this copy of ilib knows about.
Object
# static getAvailableCountry() → {Object}
Return an array of country names that this copy of ilib knows about.
an object of country code that this copy of ilib knows about.
Object