@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.
24 lines (23 loc) • 666 B
JavaScript
import { ALL_CASES_SKIPPING_DEGREE_8 } from "../../generate/formative/slot-9/index.js";
/**
* Parses a case from a `VowelForm`.
*
* @param vc The `VowelForm` to be parsed.
* @param isCaseOver36 Whether the case is over 36.
* @returns The parsed case.
*/
export function parseCase(vc, isCaseOver36 = vc.hasGlottalStop) {
const _case = ALL_CASES_SKIPPING_DEGREE_8[36 * +isCaseOver36 + 9 * (vc.sequence - 1) + vc.degree - 1];
if (_case != null) {
return _case;
}
throw new Error("Invalid Vc form: " +
vc +
" (" +
vc.sequence +
":" +
vc.degree +
":" +
isCaseOver36 +
").");
}