Module: phony

Library for translating to/from the phonetic alphabet.
Version:
  • 1.3.0
License:
  • MIT
Source:

module:phony :Object

The main phony object to be exported.
Source:

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.
Source:

(static) defaults :PhonyOptions

The default values to be used when options are not specified or incomplete.
Type:
  • PhonyOptions
Source:

(static, constant) VERSION :String

The current version of phony.
Type:
  • String
Source:

Methods

(static) clearCache() → {Object}

Clears any previously cached built alphabets.

This can be useful for when modifications have been made to the alphabet mapping.

Source:
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
Source:
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.
Source:
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
Source:
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.
Source:

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).
Source: