@zoodogood/utils 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js ADDED
@@ -0,0 +1,4 @@
1
+ export * from './packages/primitives/mod.js';
2
+
3
+
4
+
package/package.json ADDED
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "@zoodogood/utils",
3
+ "type": "module",
4
+ "version": "0.2.0",
5
+ "description": "",
6
+ "main": "index.js",
7
+ "homepage": "https://zoodogood.github.io/utils",
8
+ "scripts": {
9
+ "test": "node index",
10
+ "docs-build": "cd ./docs & retype build --output ./public"
11
+ },
12
+ "exports": {
13
+ "primitives": "./packages/primitives/mod.js"
14
+ },
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "https://github.com/zoodogood/utils"
18
+ },
19
+ "keywords": [],
20
+ "author": "",
21
+ "license": "ISC",
22
+ "devDependencies": {
23
+ "retype": "^0.2.0"
24
+ }
25
+ }
@@ -0,0 +1,26 @@
1
+ function ending(quantity = 0, base, multiple, alone, double, options = {}) {
2
+ if ( isNaN(quantity) )
3
+ return NaN;
4
+
5
+
6
+ const numbers = quantity % 100 > 20 ?
7
+ quantity % 20 :
8
+ quantity % 10;
9
+
10
+ const end = (numbers >= 5 || numbers === 0) ?
11
+ multiple :
12
+ (numbers > 1) ? double : alone;
13
+
14
+ const word = base + end;
15
+
16
+ options.unite ||= (quantity, word) => `${ quantity } ${ word }`;
17
+
18
+ const input = options.unite(quantity, word);
19
+ return input;
20
+ };
21
+
22
+
23
+ export {
24
+ ending
25
+ }
26
+
package/readme.md ADDED
@@ -0,0 +1,8 @@
1
+
2
+ A set of utilities in different directions for primitive data types.
3
+ # Docs:
4
+ https://zoodogood.github.io/utils/public
5
+
6
+ ```js
7
+ export { ending } from '@zoodogood/utils/primitives';
8
+ ```