new Utils()
Methods summary
Name | Description |
---|---|
getLanguageMatch | Computes the best match for a requested language code among an array of supported language codes. Useful for selecting the closest language among place resources or using NavigationTranslator. |
getURLParameters | Breaks down a "search" string typically used to encode arguments or parameters in a URL and returns an object whose properties are the keys or names of these parameters/flags. |
getURLParameters | Breaks down a "search" string typically used to encode arguments or parameters in a URL and returns an object whose properties are the keys or names of these parameters/flags. |
Methods detail
getLanguageMatch(preferredLanguageCode, supportedLanguageCodes) → {string}
Computes the best match for a requested language code among an array of supported language codes.
Useful for selecting the closest language among place resources or using NavigationTranslator.
Parameters:
Name | Type | Description |
---|---|---|
preferredLanguageCode |
string | Array.<string> | the requested language code or codes (string or array of strings) |
supportedLanguageCodes |
Array.<string> | the supported language codes to search |
Returns:
the supported language code closest to the requested one. Returns 'default' if no match is found.
- Type
- string
getURLParameters(search) → {Object}
Breaks down a "search" string typically used to encode arguments or parameters in a URL
and returns an object whose properties are the keys or names of these parameters/flags.
Parameters:
Name | Type | Description |
---|---|---|
search |
string | the search string to decompose. Default: window.location.search. |
Returns:
a collection of parameters
- Type
- Object
getURLParameters(search, set) → {Object}
Breaks down a "search" string typically used to encode arguments or parameters in a URL
and returns an object whose properties are the keys or names of these parameters/flags.
Parameters:
Name | Type | Description |
---|---|---|
search |
string | the search string to decompose. Default: window.location.search. |
set |
boolean | to true if you want to convert numbers. |
Returns:
a collection of parameters
- Type
- Object