Class: Transliterator

Transliterator

A Transliterator class that saves a set of transliteration rules for repeated use.


new Transliterator(substitutions)

Create a new Transliterator

Parameters:
Name Type Description
substitutions Object

The set of substitution rules that this Transliterator should use. See the transliterate method for documentation on how this substitutions object should be formatted.

Properties:
Name Type Description
substitutions Object

The set of substitution rules for this Transliterator. You can update the substitution rules used by this Transliterator at any time by modifying this object. See the transliterate method for documentation on how this substitutions object should be formatted.

Returns:

Returns a transliterate function that accepts a string and makes the substitutions provided in the transliterate argument.

Type
function
Example
const substitutions = {
  tʼ: `d`,
  ts: `c`,
};

const transliterate = new Transliterator(substitutions);
const input         = `tsatʼ`;
const output        = transliterate(input);
console.log(output); // --> "cad"