UNPKG

@yar.ua/numerals

Version:

Number to text - Inflector for Ukrainian numerals

57 lines (56 loc) 1.55 kB
export var Case; (function (Case) { Case["nominative"] = "nominative"; Case["genitive"] = "genitive"; Case["dative"] = "dative"; Case["accusative"] = "accusative"; Case["instrumental"] = "instrumental"; Case["locative"] = "locative"; Case["vocative"] = "vocative"; })(Case || (Case = {})); export var Gender; (function (Gender) { Gender["masculine"] = "masculine"; Gender["feminine"] = "feminine"; Gender["neuter"] = "neuter"; Gender["common"] = "common"; })(Gender || (Gender = {})); export var GrammaticalNumber; (function (GrammaticalNumber) { GrammaticalNumber["singular"] = "singular"; GrammaticalNumber["plural"] = "plural"; })(GrammaticalNumber || (GrammaticalNumber = {})); export var Animacy; (function (Animacy) { Animacy["inanimate"] = "inanimate"; Animacy["animate"] = "animate"; })(Animacy || (Animacy = {})); export class InflectionForm { constructor() { this["case"] = Case.nominative; this.gender = Gender.masculine; this["number"] = GrammaticalNumber.singular; this.animacy = Animacy.inanimate; } } const SHORT_MAP = { nominative: "nom", genitive: "gen", dative: "dat", accusative: "acc", instrumental: "inst", locative: "loc", vocative: "voc", masculine: "m", feminine: "f", neuter: "n", singular: "sg", plural: "pl", inanimate: "inan", animate: "anim", }; export function toString(form) { return Object.values(form) .map((x) => SHORT_MAP[x]) .join(";"); }