ru-declensions-geo
v1.0.13
Published
Library to get declensions of russian toponyms
Downloads
31
Maintainers
Readme
ru-declensions-geo
Library to decline russian geographical names.
Installation
npm install ru-declensions-geo --save
Usage
const decl = require('ru-declensions-geo').GeoNamesDeclensions;
console.log(decl.getCases('Санкт-Петербург'));
Result is:
[ 'Санкт-Петербург',
'Санкт-Петербурга',
'Санкт-Петербургу',
'Санкт-Петербург',
'Санкт-Петербургом',
'Санкт-Петербурге' ]
API
getCases(name)
Get cases for a given geographical name.
Returns an array with declined name with proper case endings:
[
nominative(именительный),
genitive(родительный),
dative(дательный),
accusative(винительный),
instrumental(творительный),
prepositional(предложный)
]
In case of empty string, returns null. If name is immutable, all cases will be filled with the same name.
inLocation(name)
Returns string "в/на [name]" for a given toponym.
Examples:
inLocation('Санкт-Петербург')
Returns: "в Санкт-Петербурге"
inLocation('Куба')
Returns: "на Кубе"
inLocation('Франция')
Returns: "во Франции"
Tests
There are many tests in test folder. You can run it with:
npm test