@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.
19 lines (18 loc) • 599 B
JavaScript
import { applyStress, countVowelForms } from "../helpers/stress.js";
/**
* Applies an essence to an unstressed referential.
*
* @param word The unstressed word to apply essence to.
* @param essence The essence to be applies.
* @returns Romanized Ithkuilic text containing the word, along with a possible
* stress indicator on a single vowel.
*/
export function applyReferentialEssence(word, essence) {
if (essence == "NRM") {
return word;
}
if (!word.startsWith("ë") && countVowelForms(word) < 2) {
word = "ë" + word;
}
return applyStress(word, -1);
}