Skip to content
greek conversion

createConverter

createConverter(configuration?): Converter

Defined in: src/converter.ts:1361 (opens in a new tab)

Creates an immutable converter with isolated character extensions.

The configuration is checked as conversion options are: a misspelled key never falls back to a default.

ConverterConfiguration = {}

Converter

import { createConverter } from "@humanities/greek-conversion";
const iso = createConverter({
preset: "iso-843-type-1",
outOfScopeBehavior: "reject",
});
iso.convert("Αθήνα", "greek", "transliteration"); // → Athī́na
iso.convert("ϟ", "greek", "transliteration");
// throws CharacterScopeError: Conversion rejected: 1 unsupported character.

An OptionError if a key of the configuration, of an alias, or of a custom character is unknown (its path is the key, such as "exclude" or "aliases[0].spellings"), if the preset or the out-of-scope behavior is, or if repertoire or exclude names no character (its path is the identifier’s place, such as "exclude[0]").

If the configuration, one of its lists, or one of its definitions has the wrong type, or if a definition is invalid: an empty or ambiguous spelling, a duplicate identifier, or a spelling that already has a meaning without override.