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.
Parameters
Section titled “Parameters”string
options?
Section titled “options?”ConversionOptions | PreparedOptions = {}
Returns
Section titled “Returns”string
Example
Section titled “Example”import { convert } from "@humanities/greek-conversion";
convert("λόγος", "greek", "beta-code"); // → lo/gosconvert("Θεσσαλονίκη", "greek", "transliteration", { preset: "iso-843-type-2",});// → ThessaloníkiThrows
Section titled “Throws”If input is not a string.
Throws
Section titled “Throws”If a format is unknown; an OptionError (a
RangeError) if a preset, an option key, or an option value is.