UNPKG

@yar.ua/numerals

Version:

Number to text - Inflector for Ukrainian numerals

23 lines (22 loc) 678 B
import { RelationDef } from "./relation.js"; export class SyntaxEdge { constructor(parent, child, rel) { this.parent = parent; this.child = child; this.rel = rel; } agree() { const relation = RelationDef[this.rel]; const modifier = relation.modifier(this.parent.lexeme, this.child.lexeme); this.child.lexeme.updateForm(modifier); this.child.agree(); const governing = relation.governing(this.child.lexeme, this.parent.lexeme); this.parent.lexeme.updateForm(governing); } toObject() { return { rel: this.rel, to: this.child.toObject(), }; } }