Library for translating to/from the phonetic alphabet.
module:phony :Object
The main
phony
object to be exported.
Members
(static) alphabets :Object.<String, PhoneticAlphabet>
The configurations for the initially supported phonetic alphabets.
Type:
- Object.<String, PhoneticAlphabet>
Properties:
Name | Type | Description |
---|---|---|
ansi |
PhoneticAlphabet | The American National Standards Institute (ANSI) phonetic alphabet configuration. |
faa |
PhoneticAlphabet | The Federal Aviation Administration (FAA) phonetic alphabet configuration. |
icao |
PhoneticAlphabet | The International Civil Aviation Organization (ICAO) phonetic alphabet configuration. |
itu |
PhoneticAlphabet | The International Telecommunication Union (ITU) phonetic alphabet configuration. |
(static) defaults :PhonyOptions
The default values to be used when options are not specified or incomplete.
Type:
- PhonyOptions
(static, constant) VERSION :String
The current version of
phony
.
Type:
- String
Methods
(static) clearCache() → {Object}
Clears any previously cached built alphabets.
This can be useful for when modifications have been made to the alphabet mapping.
Returns:
A reference to this
phony
for chaining.
- Type
- Object
(static) from(messageopt, optionsopt) → {String}
Translates the
message
provided from the phonetic alphabet.
The message may not be translated correctly if the some of the options used to translate the message originally
are not the same as those in options
.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
message |
String |
<optional> |
"" | the string to be translated from the phonetic alphabet |
options |
PhonyOptions |
<optional> |
{} | the options to be used |
Returns:
The translation from the specified phonetic alphabet
message
.
- Type
- String
(static) noConflict() → {Object}
Runs phony in no conflict mode, returning the
phony
global variable to it's previous owner, if
any.
Returns:
A reference to this
phony
.
- Type
- Object
(static) to(messageopt, optionsopt) → {String}
Translates the
message
provided to the phonetic alphabet.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
message |
String |
<optional> |
"" | the string to be translated to the phonetic alphabet |
options |
PhonyOptions |
<optional> |
{} | the options to be used |
Returns:
The phonetic alphabet translation of the specified
message
.
- Type
- String
Type Definitions
PhoneticAlphabet
A phonetic alphabet configuration.
Type:
- Object
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
characters |
Object.<String, String> | The map of characters and their phonetic counterparts. | |
fallback |
String |
<optional> |
The name of the fallback alphabet. |
PhonyOptions
Options to be passed to the primary
phony
methods.
Type:
- Object
Properties:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
alphabet |
String |
<optional> |
"itu" | The default name of the alphabet to be used for the translation. |
cache |
Boolean |
<optional> |
true | Whether a cache should be used for built alphabets to to improve performance. This cache can be disabled and/or cleared to avoid when modifying alphabets. |
letterSplitter |
String |
<optional> |
" " | The default string to be used to split alphabetic letters (may be passed
to RegExp constructor). |
wordSplitter |
String |
<optional> |
"space" | The default string to be used to split words (may be passed to
RegExp constructor). |