### Repository Cloning and Setup
Source: https://github.com/nodkz/lvovich/blob/master/README.md
Provides commands to clone the lvovich project repository from GitHub and install its development dependencies using yarn. This is for developers contributing to the library.
```bash
git clone https://github.com/nodkz/lvovich.git
cd lvovich
yarn install
```
--------------------------------
### Installation via npm
Source: https://github.com/nodkz/lvovich/blob/master/README.md
Installs the lvovich library using npm, the Node Package Manager. This command is typically run in a project's root directory.
```bash
npm install lvovich
```
--------------------------------
### Browser Usage Example
Source: https://github.com/nodkz/lvovich/blob/master/README.md
Demonstrates how to include the lvovich library in a web page using a CDN link and then use its functions, such as cityIn, cityFrom, and cityTo, within a script tag.
```html
```
--------------------------------
### Running Tests
Source: https://github.com/nodkz/lvovich/blob/master/README.md
Executes the test suite for the lvovich library using the yarn package manager. This command is used to verify the functionality and integrity of the code.
```bash
yarn test
```
--------------------------------
### Library Import
Source: https://github.com/nodkz/lvovich/blob/master/README.md
Imports the core declension functions from the lvovich library. These functions are used to handle the grammatical cases of Russian names.
```javascript
import { incline, inclineFirstname, inclineLastname, inclineMiddlename } from 'lvovich';
```
--------------------------------
### Inflect Russian City Names
Source: https://github.com/nodkz/lvovich/blob/master/README.md
Provides functions to decline Russian city names into different grammatical cases (prepositional, genitive, accusative/allative). These functions are useful for generating grammatically correct sentences about locations.
```javascript
import { cityIn, cityFrom, cityTo } from 'lvovich';
// Example usage:
console.log(cityIn('Санкт-Петербург')); // Output: Санкт-Петербурге
console.log(cityFrom('Санкт-Петербург')); // Output: Санкт-Петербурга
console.log(cityTo('Санкт-Петербург')); // Output: Санкт-Петербург
console.log(cityTo('Москва')); // Output: Москву
```
--------------------------------
### Incline Firstname Function
Source: https://github.com/nodkz/lvovich/blob/master/README.md
Declines a given first name (имя) into a specified grammatical case. It supports automatic gender detection if the gender is not explicitly provided. The default declension case is accusative.
```APIDOC
inclineFirstname(str: string, declension?: DeclentionStrT, gender?: GenderStrT): string
Declines a first name into a specified case.
Parameters:
str: string - The first name to decline.
declension?: DeclentionStrT - The grammatical case to decline into. Defaults to 'accusative'.
gender?: GenderStrT - The gender of the person ('male' or 'female'). If not provided, the library attempts auto-detection.
Returns:
string - The declined first name.
Example:
inclineFirstname('Павел', 'genitive'); // Returns: 'Павла'
inclineFirstname('Женя', 'instrumental'); // Returns: 'Женя' (auto-detects gender, might be ambiguous)
inclineFirstname('Женя', 'instrumental', 'male'); // Returns: 'Женей'
inclineFirstname('Женя', 'instrumental', 'female'); // Returns: 'Женей'
```
--------------------------------
### Incline Function for Full Person Object
Source: https://github.com/nodkz/lvovich/blob/master/README.md
Declines a full person object containing first name, last name, and middle name. If no specific declension case is provided, it defaults to the accusative case. The function returns the person object with declined names.
```APIDOC
incline(person: LvovichPersonT, declension?: DeclentionStrT): LvovichPersonT
Declines a person object by specified case.
Parameters:
person: LvovichPersonT - An object representing the person. It can include optional fields: `first`, `last`, `middle`, `gender`.
declension?: DeclentionStrT - The grammatical case to decline into. Defaults to 'accusative' if not provided.
Returns:
LvovichPersonT - The person object with declined name parts.
Example:
incline({ first: 'Саша', last: 'Иванов' }, 'dative');
// Returns: { first: 'Саше', last: 'Иванову', gender: 'male' }
incline({ first: 'Паша' }, 'instrumental');
// Returns: { first: 'Пашей', gender: 'male' }
LvovichPersonT Type:
{
first?: ?string,
last?: ?string,
middle?: ?string,
gender?: ?GenderStrT,
}
```
--------------------------------
### Determine Gender from Russian Names
Source: https://github.com/nodkz/lvovich/blob/master/README.md
Offers functions to determine the gender (male, female, androgynous, or null if indeterminate) from Russian first names, last names, patronymics, or a full name (FIO). This is useful for personalizing communication.
```javascript
import { getGender, getFirstnameGender, getLastnameGender, getMiddlenameGender } from 'lvovich';
// Type definition for FIO (First, Middle, Last Name)
type FioT = {
first?: ?string,
last?: ?string,
middle?: ?string,
}
type GenderStrT = 'male' | 'female' | 'androgynous' | null;
// Example usage:
console.log(getGender({ last: 'Друзь', first: 'Саша', middle: 'Петрович' })); // Output: male
console.log(getFirstnameGender('Павел')); // Output: male
console.log(getLastnameGender('Таптыгина')); // Output: female
console.log(getMiddlenameGender('Петрова')); // Output: female
console.log(getGender({ first: 'Саша' })); // Output: androgynous
console.log(getGender({ last: 'Абуова', first: 'Андрей' })); // Output: null
```
--------------------------------
### Incline Middlename Function
Source: https://github.com/nodkz/lvovich/blob/master/README.md
Declines a given patronymic (отчество) into a specified grammatical case. Similar to other functions, it supports explicit gender specification and defaults to the accusative case if no declension is provided.
```APIDOC
inclineMiddlename(str: string, declension?: DeclentionStrT, gender?: GenderStrT): string
Declines a patronymic into a specified case.
Parameters:
str: string - The patronymic to decline.
declension?: DeclentionStrT - The grammatical case to decline into. Defaults to 'accusative'.
gender?: GenderStrT - The gender of the person ('male' or 'female').
Returns:
string - The declined patronymic.
Example:
inclineMiddlename('Львович', 'genitive'); // Returns: 'Львовича'
```
--------------------------------
### Incline Lastname Function
Source: https://github.com/nodkz/lvovich/blob/master/README.md
Declines a given last name (фамилия) into a specified grammatical case. It allows for explicit gender specification to ensure correct declension, especially for names that might be ambiguous. The default declension case is accusative.
```APIDOC
inclineLastname(str: string, declension?: DeclentionStrT, gender?: GenderStrT): string
Declines a last name into a specified case.
Parameters:
str: string - The last name to decline.
declension?: DeclentionStrT - The grammatical case to decline into. Defaults to 'accusative'.
gender?: GenderStrT - The gender of the person ('male' or 'female'). Crucial for correct declension of some surnames.
Returns:
string - The declined last name.
Example:
inclineLastname('Иванова', 'genitive'); // Returns: 'Ивановой'
inclineLastname('Петросян', 'instrumental'); // Returns: 'Петросян' (common for Armenian surnames)
inclineLastname('Петросян', 'instrumental', 'male'); // Returns: 'Петросяном'
```
=== COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.