@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.
39 lines (38 loc) • 1.12 kB
JavaScript
import { deepFreeze } from "../helpers/deep-freeze.js";
/** An array containing all extensions. */
export const ALL_EXTENSIONS = /* @__PURE__ */ deepFreeze([
"DEL",
"PRX",
"ICP",
"ATV",
"GRA",
"DPL",
]);
/** An object mapping from extensions to their names. */
export const EXTENSION_TO_NAME_MAP = /* @__PURE__ */ deepFreeze({
DEL: "Delimitive",
PRX: "Proximal",
ICP: "Inceptive",
ATV: "Attenuative",
GRA: "Graduative",
DPL: "Depletive",
});
/** An object mapping from extensions to their Ithkuilic translations. */
export const EXTENSION_TO_ITHKUIL_MAP = /* @__PURE__ */ deepFreeze({
DEL: ["", ""],
PRX: ["t", "d"],
ICP: ["k", "g"],
ATV: ["p", "b"],
GRA: ["g", "gz"],
DPL: ["b", "bz"],
});
/**
* Converts an extension into Ithkuil.
*
* @param extension The extension to be converted.
* @param isCAUniplex Whether the Ca affix complex is marked Uniplex.
* @returns Romanized Ithkuilic text representing the extension.
*/
export function extensionToIthkuil(extension, isCAUniplex) {
return EXTENSION_TO_ITHKUIL_MAP[extension][+isCAUniplex];
}