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.

21 lines (20 loc) 743 B
import { stdin, stdout } from "node:process"; import { createInterface } from "node:readline/promises"; import { glossWord } from "../gloss/index.js"; import { parseWord } from "../parse/index.js"; const rl = createInterface(stdin, stdout); while (true) { const inputWord = await rl.question("\nWord: "); try { const parsedWord = parseWord(inputWord); if (parsedWord == null) { throw new Error("Invalid word: '" + inputWord + "'."); } const gloss = glossWord(parsedWord); console.log("Gloss: " + gloss.short); console.log("Gloss: " + gloss.full); } catch (error) { console.error("Error: " + (error instanceof Error ? error.message : String(error))); } }