shevchenko
Version:
JavaScript library for declension of Ukrainian anthroponyms
41 lines (37 loc) • 1.35 kB
JavaScript
/**
* @file JavaScript library for declension of Ukrainian anthroponyms
* @module shevchenko
* @version 3.1.4
* @author Oleksandr Tolochko <shevchenko-js@tooleks.com>
* @license MIT
* @copyright 2017-2025 Oleksandr Tolochko <shevchenko-js@tooleks.com>
* @see {@link git+https://github.com/tooleks/shevchenko-js.git}
*/
;
var bootstrap = require('./word-declension/bootstrap.js');
const registeredExtensions = [];
function registerExtension(extensionFactory) {
const extension = extensionFactory({ wordInflector: bootstrap.wordInflector });
registeredExtensions.push(extension);
}
function getCustomFieldNames() {
const fieldNames = [];
for (const extension of registeredExtensions) {
fieldNames.push(...extension.fieldNames);
}
return fieldNames;
}
async function afterInflect(grammaticalCase, input) {
var _a;
const output = {};
for (const extension of registeredExtensions) {
const customOutput = await ((_a = extension.afterInflect) === null || _a === void 0 ? void 0 : _a.call(extension, grammaticalCase, input));
if (customOutput != null) {
Object.assign(output, customOutput);
}
}
return output;
}
exports.afterInflect = afterInflect;
exports.getCustomFieldNames = getCustomFieldNames;
exports.registerExtension = registerExtension;