@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.
30 lines (29 loc) • 1.06 kB
JavaScript
import { deepFreeze } from "../helpers/deep-freeze.js";
/** An array containing all affiliations. */
export const ALL_AFFILIATIONS =
/* @__PURE__ */ deepFreeze(["CSL", "COA", "ASO", "VAR"]);
/** An object mapping affiliations to their names. */
export const AFFILIATION_TO_NAME_MAP = /* @__PURE__ */ deepFreeze({
CSL: "Consolidative",
COA: "Coalescent",
ASO: "Associative",
VAR: "Variative",
});
/** An object mapping affiliations to their Ithkuilic translations. */
export const AFFILIATION_TO_ITHKUIL_MAP = /* @__PURE__ */ deepFreeze({
CSL: ["", ""],
COA: ["r", "rļ"],
ASO: ["l", "nļ"],
VAR: ["ř", "ň"],
});
/**
* Converts an affiliation into Ithkuil.
*
* @param affiliation The affiliation to be converted.
* @param isStandalone Whether the affiliation is the only affix present in the
* Ca affix complex.
* @returns Romanized Ithkuilic text representing the affiliation.
*/
export function affiliationToIthkuil(affiliation, isStandalone) {
return AFFILIATION_TO_ITHKUIL_MAP[affiliation][+isStandalone];
}