@yar.ua/numerals
Version:
Number to text - Inflector for Ukrainian numerals
30 lines (29 loc) • 811 B
JavaScript
import { InflectionForm, toString } from "../grammar.js";
export class Lexeme {
constructor(value, form, persistent_form) {
this._form = new InflectionForm();
Object.assign(this._form, form || {});
this.value = value;
this.persistent_form = persistent_form || {};
}
form() {
return Object.assign({}, this._form, this.persistent_form);
}
updateForm(form) {
Object.assign(this._form, form);
}
inflected(form) {
throw new Error("not implemented");
}
text() {
throw new Error("not implemented");
}
toObject() {
return {
kind: "Lexeme",
value: this.value,
persistent_form: toString(this.persistent_form),
form: toString(this._form),
};
}
}