Compare commits

..

6 Commits

Author SHA1 Message Date
Valentin Silytuin 9ac5f6bd28 Publish
- @advdominion/pluralize@1.0.1
2024-05-03 19:43:45 +04:00
Valentin Silytuin 09f069b727 Fix README.md in @advdominion/pluralize 2024-05-03 19:43:22 +04:00
Valentin Silytuin f9dc305aae Update README.md 2024-05-03 19:39:02 +04:00
Valentin Silytuin 7d56c06702 Publish
- @advdominion/pluralize@1.0.0
2024-05-03 19:34:44 +04:00
Valentin Silytuin 0bb60a0e0a @advdominion/pluralize 2024-05-03 19:34:19 +04:00
Valentin Silytuin 205ea19086 Add README.md 2024-05-03 19:25:40 +04:00
5 changed files with 58 additions and 0 deletions

13
README.md Normal file
View File

@ -0,0 +1,13 @@
# helpers
## Добавление нового пакета
1. Скопировать один из существующих пакетов в папке `packages`
2. На его основе подготовить новый пакет
3. Запустить `yarn`
## Публикация новых версий
```
yarn lerna publish
```

View File

@ -0,0 +1,11 @@
# pluralize
Склонение существительных в зависимости от чила
## Использование
```js
import { pluralize } from '@advdominion/pluralize';
console.log(pluralize(1, ['яблоко', 'яблока', 'яблок']));
```

View File

@ -0,0 +1,14 @@
export const pluralize = (count, words) => {
count = Math.abs(count) % 100;
const count10 = count % 10;
if (count > 10 && count < 20) {
return words[2];
}
if (count10 > 1 && count10 < 5) {
return words[1];
}
if (count10 === 1) {
return words[0];
}
return words[2];
};

View File

@ -0,0 +1,14 @@
{
"name": "@advdominion/pluralize",
"version": "1.0.1",
"type": "module",
"main": "index.js",
"repository": {
"type": "git",
"url": "https://gitea.optiweb.ru/public/helpers.git"
},
"license": "MIT",
"publishConfig": {
"access": "public"
}
}

View File

@ -17,6 +17,12 @@ __metadata:
languageName: unknown
linkType: soft
"@advdominion/pluralize@workspace:packages/pluralize":
version: 0.0.0-use.local
resolution: "@advdominion/pluralize@workspace:packages/pluralize"
languageName: unknown
linkType: soft
"@babel/code-frame@npm:^7.0.0":
version: 7.24.2
resolution: "@babel/code-frame@npm:7.24.2"