
Security News
Package Maintainers Call for Improvements to GitHub’s New npm Security Plan
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
word-decliner
Advanced tools
Declines words such as names, single or even combination of words via Morpher service.
Helps you to decline words such as names, single or even combination of words via Morpher service located on http://morpher.ru/Demo.aspx in three available languages: Russian, Ukrainian and Kazakh.
Maybe it works for some other languages, who knows.
word-decliner
is available via NPM:
$ npm i word-decliner@1.2.0
According to http://morpher.ru/DemoUA.aspx?s=Микола%20Петренко
import wordDecliner, { uaDecliner } from 'word-decliner';
(async () => {
console.log(await wordDecliner('ua', 'Микола Петренко'));
// The same as
console.log(await uaDecliner('Микола Петренко'));
/*
[
{ case: 'називний', value: 'Микола Петренко' },
{ case: 'родовий', value: 'Миколи Петренка' },
{ case: 'давальний', value: 'Миколі Петренку' },
{ case: 'знахідний', value: 'Миколу Петренка' },
{ case: 'орудний', value: 'Миколою Петренком' },
{ case: 'місцевий', value: 'Миколі Петренку' },
{ case: 'кличний', value: 'Миколо Петренку' },
]
*/
})();
Available language identifiers: ru, ua, kz.
According to:
import wordDecliner from 'word-decliner';
(async () => {
console.log(await wordDecliner('ru', 'Киев', 'именительный'));
// { case: 'именительный', value: 'Киев', plural: 'Киевы' }
console.log(await wordDecliner('ru', 'Киев', 'орудний'));
// { case: 'творительный', value: 'Киевом', plural: 'Киевами' }
console.log(await wordDecliner('ua', 'Київ', 'к'));
// { case: 'кличний', value: 'Києве' }
console.log(await wordDecliner('kz', 'Киев', 'жатыс'));
/*
{
case: 'местный',
kzCase: 'жатыс',
'саны': [ 'Киевте', 'Киевтерде' ],
'менiң': [ 'Киевімде', 'Киевтерімде' ],
'сенiң': [ 'Киевіңде', 'Киевтеріңде' ],
'сіздiң': [ 'Киевіңізде', 'Киевтеріңізде' ],
'оның': [ 'Киевінде', 'Киевтерінде' ],
'біздiң': [ 'Киевімізде', 'Киевтерімізде' ],
'сендердiң': [ 'Киевтеріңде', 'Киевтеріңде' ],
'сіздердiң': [ 'Киевтеріңізде', 'Киевтеріңізде' ],
'олардың': [ 'Киевтерінде', 'Киевтерінде' ],
}
*/
})();
import { ruDecliner, uaDecliner, kzDecliner } from 'word-decliner';
(async () => {
console.log(await ruDecliner('ключ', 'д'));
// { case: 'дательный', value: 'ключу', plural: 'ключам' }
console.log(await uaDecliner('ключ', 'д'));
// { case: 'давальний', value: 'ключу' }
console.log(await kzDecliner('ключ', 'д'));
/*
{
case: 'дательно-направительный',
kzCase: 'барыс',
'саны': [ 'ключке', 'ключтерге' ],
'менiң': [ 'ключіме', 'ключтеріме' ],
'сенiң': [ 'ключіңе', 'ключтеріңе' ],
'сіздiң': [ 'ключіңізге', 'ключтеріңізге' ],
'оның': [ 'ключіне', 'ключтеріне' ],
'біздiң': [ 'ключімізге', 'ключтерімізге' ],
'сендердiң': [ 'ключтеріңе', 'ключтеріңе' ],
'сіздердiң': [ 'ключтеріңізге', 'ключтеріңізге' ],
'олардың': [ 'ключтеріне', 'ключтеріне' ],
}
*/
})();
import { uaDecliner } from 'word-decliner';
import elapsingTime from 'elapsing-time';
const wait = (ms: number) => new Promise<void>(res => setTimeout(res, ms));
const timer = new elapsingTime();
(async () => {
timer.start();
const res1 = await uaDecliner('слово', 'дательный');
timer.stop(true);
console.log(res1); // { case: 'давальний', value: 'слову' }
timer.msPrint(); // Time: 357.278 ms
await wait(500);
timer.start();
const res2 = await uaDecliner('слово', 'знахідний');
timer.stop(true);
console.log(res2); // { case: 'знахідний', value: 'слово' }
timer.msPrint(); // Time: 0.17 ms // Almost instant invocation
// await wait(24 * 3600 * 1000); // Wait for 24 hours or more // Too long to demonstrate
timer.start();
const res3 = await uaDecliner('слово');
timer.stop(true);
console.log(res3);
timer.msPrint(); // Time: 319.122 ms // Again not instant because of expired cache
/*
[
{ case: 'називний', value: 'слово' },
{ case: 'родовий', value: 'слова' },
{ case: 'давальний', value: 'слову' },
{ case: 'знахідний', value: 'слово' },
{ case: 'орудний', value: 'словом' },
{ case: 'місцевий', value: 'слові' },
{ case: 'кличний', value: 'слове' },
]
*/
})();
Manually tested by the developer during development. Automated tests are not provided.
Your improve suggestions and bug reports are welcome any time.
FAQs
Declines words such as names, single or even combination of words via Morpher service.
We found that word-decliner demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
Product
Socket Firewall is a free tool that blocks malicious packages at install time, giving developers proactive protection against rising supply chain attacks.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.