ru-declensions-geo

1.0.13 • Public • Published

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

Package Sidebar

Install

npm i ru-declensions-geo

Weekly Downloads

17

Version

1.0.13

License

MIT

Unpacked Size

922 kB

Total Files

15

Last publish

Collaborators

  • nj212jn