@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.
17 lines (16 loc) • 488 B
JavaScript
import { n } from "../lex/forms.js";
/**
* Builds a numeric adjunct.
*
* @param word The word to be built.
* @returns Either a parsed `NumericAdjunct` indicating a success, or
* `undefined` indicating a tokenization failure. Throws if the adjunct was
* successfully tokenized but had another error in it (e.g. invalid number).
*/
export function buildNumericAdjunct(word) {
const match = n.exec(word);
if (!match) {
return;
}
return BigInt(match[0]);
}