
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
#Petrovich#
Библиотека для склонения падежей русских имен, фамилий и отчеств.
Используйте npm:
npm install petrovich
Используйте bower:
bower install petrovich
Или вручную. Ссылка: petrovich.min.js
В браузере:
<script type="text/javascript" src="/path/to/petrovich/dist/petrovich.min.js"></script>
В NodeJS:
var petrovich = require('petrovich');
Петровича можно использовать двумя способами.
###Первый вариант:
// создаем объект person, содержащий параметр gender
// и хотя бы один из параметров first, middle и last
var person = {
gender: 'male',
first: 'Петр',
last: 'Чайковский'
};
// вызываем Петровича как функцию, указав падеж:
petrovich(person, 'dative');
// вернет копию объекта:
// {gender: 'male', first: 'Петру', last: 'Чайковскому'}
Если указано отчество, можно опустить пол, он определится автоматически:
var person = {
first: 'Петр',
middle: 'Ильич',
last: 'Чайковский'
};
petrovich(person, 'dative');
// вернет:
// {first: 'Петру', middle: 'Ильичу', last: 'Чайковскому', gender: 'male'}
###Второй вариант использования:
// Петрович обладает цепочкой методов вида petrovich[gender][nametype][case]:
petrovich.male.first.genitive('Андрей') // вернет "Андрея"
petrovich.female.last.accusative('Иванова') // вернет "Иванову"
Петрович может определить пол по отчеству, используя простое правило:
petrovich.detect_gender('Иванович') // вернет 'male'
petrovich.detect_gender('Ильинична') // вернет 'female'
petrovich.detect_gender('Блаблабла') // вернет 'androgynous'
Пол может иметь одно из следующих значений:
Типы имени:
Падежи:
Два ключевых файла проекта:
Правила включаются в модуль в процессе сборки (см. ниже).
В проекте используется следующие инструменты:
Установка инструментов:
sudo npm install -g grunt-cli
sudo npm install -g jasmine-node
Клонирование репозитория:
git clone https://github.com/petrovich/petrovich-js.git
Установка локальных модулей:
npm install
Тесты находятся в директории tests/spec/. Запуск тестов:
jasmine-node tests/spec/
# или просто:
npm test
Сборка проекта в директорию dist (включает rules.json в petrovich.js и создает минифицированную копию последнего)
grunt build
FAQs
JS library to inflect Russian first, middle and last names
The npm package petrovich receives a total of 1,075 weekly downloads. As such, petrovich popularity was classified as popular.
We found that petrovich 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.