shevchenko
Version:
JavaScript library for declension of Ukrainian anthroponyms
28 lines (25 loc) • 937 B
JavaScript
/**
* @file JavaScript library for declension of Ukrainian anthroponyms
* @module shevchenko
* @version 3.2.2
* @author Oleksandr Tolochko <shevchenko-js@tooleks.com>
* @license MIT
* @copyright 2017-2026 Oleksandr Tolochko <shevchenko-js@tooleks.com>
* @see {@link git+https://github.com/tooleks/shevchenko-js.git}
*/
;
class NameInflector {
/**
* Inflects the name in the given grammatical case.
*/
async inflect(name, gender, grammaticalCase) {
const inflectedNameParts = [];
const nameParts = name.split('-');
for (let index = 0; index < nameParts.length; index += 1) {
const inflectedNamePart = await this.inflectNamePart(nameParts[index], gender, grammaticalCase, index === nameParts.length - 1);
inflectedNameParts.push(inflectedNamePart);
}
return inflectedNameParts.join('-');
}
}
exports.NameInflector = NameInflector;