Class Index | File Index

Classes


Class Country

Create a new country information instance. Instances of this class encode information about country name.

The options can contain any of the following properties:

If the locale is not set, the default locale(en-US) will be used.


Defined in: Country.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
Country(options)
Method Summary
Method Attributes Method Name and Description
<static>  
Country.getAvailableCode()
Return an array of the ids for all ISO 3166-1 alpha-2 code that this copy of ilib knows about.
<static>  
Return an array of country names that this copy of ilib knows about.
 
getCode(ctryname)
Return the country code corresponding to the country name given.
 
Return the locale for this country.
 
getName(code)
Return the country name corresponding to the country code given.
Class Detail
Country(options)
Parameters:
options
{Object} a set of properties to govern how this instance is constructed.
Method Detail
<static> {Object} Country.getAvailableCode()
Return an array of the ids for all ISO 3166-1 alpha-2 code that this copy of ilib knows about.
Returns:
{Object} an object of country code that this copy of ilib knows about.

<static> {Object} Country.getAvailableCountry()
Return an array of country names that this copy of ilib knows about.
Returns:
{Object} an object of country code that this copy of ilib knows about.

{string} getCode(ctryname)
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:
{string} ctryname
The country name in the language of the locale of this instance
Throws:
"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.
Returns:
{string} the country code corresponding to the country name

{Locale} getLocale()
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.
Returns:
{Locale} the locale used in the constructor of this instance, or undefined if no locale was given in the constructor

{string} getName(code)
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:
{string} code
The country code to get the country name
Throws:
"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.
Returns:
{string} the country name in the language of the locale of this instance

Documentation generated by JsDoc Toolkit 2.4.0 on Thu Nov 15 2018 17:45:08 GMT-0800 (PST)