Skip to content
greek conversion

reencode

reencode(input, format, options?): string

Defined in: src/core.ts:139 (opens in a new tab)

Parses and re-encodes text in the same format: convert with the reader and the writer of one format.

The options describe the input as well, which normalizes a text in its own style. Reading transliteration depends on its options: to restyle a transliteration, prepare options with the style it is written in as source.

string

ReaderWriter

The reader and writer of the format, as greekFormat.

PreparedOptions

A preset from ./presets, or what prepareOptions returns; the defaults if omitted.

string

import { prepareOptions, reencode } from "@humanities/greek-conversion/core";
import { transliterationFormat } from "@humanities/greek-conversion/transliteration";
const fromDefaults = prepareOptions({
transliteration: { phi: "f" },
source: {},
});
reencode("phílos", transliterationFormat, fromDefaults); // → fílos

If input is not a string, format not a reader and writer, or options not prepared options.