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.
Parameters
Section titled “Parameters”string
format
Section titled “format”The reader and writer of the format, as greekFormat.
options?
Section titled “options?”A preset from ./presets, or what prepareOptions
returns; the defaults if omitted.
Returns
Section titled “Returns”string
Example
Section titled “Example”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ílosThrows
Section titled “Throws”If input is not a string, format not a reader and
writer, or options not prepared options.