Skip to content
greek conversion

convert

convert(input, from, to, options?): string

Defined in: src/mod.ts:178 (opens in a new tab)

Converts text between Greek, Beta Code, and scientific transliteration.

Unknown literals are preserved. The result is canonical and idempotent for fixed formats and options, converted again without source, but a reverse conversion is not necessarily lossless; use convertDetailed when that distinction matters.

Without a preset, transliteration is the library’s own: the letters of the SBL Handbook of Style, with the accents, iota subscript, diaeresis, and quantity marks that the Handbook leaves out.

The defaults and each preset are checked and resolved once; other options, at each call, unless they are prepared once with prepareOptions.

string

Format

Format

ConversionOptions | PreparedOptions = {}

string

import { convert } from "@humanities/greek-conversion";
convert("λόγος", "greek", "beta-code"); // → lo/gos
convert("Θεσσαλονίκη", "greek", "transliteration", {
preset: "iso-843-type-2",
});
// → Thessaloníki

If input is not a string.

If a format is unknown; an OptionError (a RangeError) if a preset, an option key, or an option value is.