1.0.13 • Published 1 year ago

ru-declensions-geo v1.0.13

Weekly downloads
6
License
MIT
Repository
github
Last release
1 year ago

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
1.0.13

1 year ago

1.0.12

3 years ago

1.0.11

4 years ago

1.0.10

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago