UNPKG

@zsnout/ithkuil

Version:

A set of tools which can generate and parse romanized Ithkuil text and which can generate Ithkuil script from text and JSON data.

29 lines (28 loc) 905 B
import { affixToIthkuil } from "../../affix/index.js"; import { EMPTY, WithWYAlternative } from "../../helpers/with-wy-alternative.js"; /** * Converts Slot V into Ithkuil. * * @param slot The Slot V affixes of the formative. * @param metadata Additional information relevant to Slot V. * @returns A `WithWYAlternative` containing romanized Ithkuilic text * representing Slot V. */ export function slotVToIthkuil(slot, metadata) { if (slot.length == 0) { return EMPTY; } if (metadata.isSlotVIElided) { return slot .map((affix, index) => affixToIthkuil(affix, { reversed: false, insertGlottalStop: index == slot.length - 1, })) .reduce((a, b) => a.add(b)); } else { return slot .map((affix) => affixToIthkuil(affix, { reversed: true })) .reduce((a, b) => a.add(b)); } }