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.

51 lines (50 loc) 1.25 kB
import { deepFreeze } from "../../helpers/deep-freeze.js"; /** An array containing all valences. */ export const ALL_VALENCES = [ "MNO", "PRL", "CRO", "RCP", "CPL", "DUP", "DEM", "CNG", "PTI", ]; /** An object mapping from valences to their Ithkuilic translations. */ export const VALENCE_TO_ITHKUIL_MAP = /* @__PURE__ */ deepFreeze({ MNO: "a", PRL: "ä", CRO: "e", RCP: "i", CPL: "ëi", DUP: "ö", DEM: "o", CNG: "ü", PTI: "u", }); /** An object mapping from valences to their names. */ export const VALENCE_TO_NAME_MAP = /* @__PURE__ */ deepFreeze({ MNO: "Monoactive", PRL: "Parallel", CRO: "Corollary", RCP: "Reciprocal", CPL: "Complementary", DUP: "Duplicative", DEM: "Demonstrative", CNG: "Contingent", PTI: "Participatory", }); /** * Converts a valence into Ithkuil. * * @param valence The valence to be converted. * @param omitDefaultValence Whether MNO valence should be omitted. * @returns Romanized Ithkuilic text representing the valence. */ export function valenceToIthkuil(valence, omitDefaultValence) { if (omitDefaultValence && valence == "MNO") { return ""; } return VALENCE_TO_ITHKUIL_MAP[valence]; }