Compare commits

...

8 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
Valentin Silytuin 1eff119186 Publish
- @advdominion/is@1.0.1
2024-05-03 19:24:09 +04:00
Valentin Silytuin 78e4fa36c0 Обновлён README.md в @advdominion/is 2024-05-03 19:23:51 +04:00
7 changed files with 62 additions and 2 deletions

13
README.md Normal file
View File

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

View File

@ -1,6 +1,8 @@
# is # is
Usage: Check variable type
## Usage
```js ```js
import { is } from '@advdominion/is'; import { is } from '@advdominion/is';

View File

@ -1,6 +1,6 @@
{ {
"name": "@advdominion/is", "name": "@advdominion/is",
"version": "1.0.0", "version": "1.0.1",
"type": "module", "type": "module",
"main": "index.js", "main": "index.js",
"repository": { "repository": {

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 languageName: unknown
linkType: soft 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": "@babel/code-frame@npm:^7.0.0":
version: 7.24.2 version: 7.24.2
resolution: "@babel/code-frame@npm:7.24.2" resolution: "@babel/code-frame@npm:7.24.2"