@zoodogood/utils 0.8.2 → 0.8.4
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/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zoodogood/utils",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.8.
|
|
4
|
+
"version": "0.8.4",
|
|
5
5
|
"description": "",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"homepage": "https://zoodogood.github.io/utils",
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
"test": "node index",
|
|
10
10
|
"docs-build": "cd ./docs & retype build --output ./public"
|
|
11
11
|
},
|
|
12
|
+
"typings": "types/index",
|
|
12
13
|
"exports": {
|
|
13
14
|
"./primitives": "./packages/primitives/mod.js",
|
|
14
15
|
"./objectives": "./packages/objectives/mod.js",
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef GetRandomValueOptions
|
|
3
|
+
* @property {number} [min = 0]
|
|
4
|
+
* @property {number} max
|
|
5
|
+
* @property {boolean} [round=true]
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
*
|
|
10
|
+
* @param {GetRandomValueOptions} param0
|
|
11
|
+
* @returns {number}
|
|
12
|
+
*/
|
|
13
|
+
function getRandomValue({min = 0, max, round = true}){
|
|
14
|
+
let value = Math.random() * (max - min + Number(round)) + min;
|
|
15
|
+
|
|
16
|
+
if (round){
|
|
17
|
+
value = Math.floor(value);
|
|
18
|
+
}
|
|
19
|
+
return value;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export { getRandomValue };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export * from './CustomCollector.js';
|
|
2
2
|
export * from './GlitchText.js';
|
|
3
|
+
export * from './getRandomValue.js';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* @param {object} object
|
|
@@ -16,25 +17,6 @@ function omit(object, filter){
|
|
|
16
17
|
|
|
17
18
|
|
|
18
19
|
|
|
19
|
-
/**
|
|
20
|
-
* @typedef GetRandomValueOptions
|
|
21
|
-
* @property {number} [min = 0]
|
|
22
|
-
* @property {number} max
|
|
23
|
-
* @property {boolean} [round=true]
|
|
24
|
-
*/
|
|
25
20
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
* @param {GetRandomValueOptions} param0
|
|
29
|
-
* @returns {number}
|
|
30
|
-
*/
|
|
31
|
-
function getRandomValue({min = 0, max, round = true}){
|
|
32
|
-
let value = Math.random() * (max - min + Number(round)) + min;
|
|
33
|
-
|
|
34
|
-
if (round){
|
|
35
|
-
value = Math.floor(value);
|
|
36
|
-
}
|
|
37
|
-
return value;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export { omit, getRandomValue };
|
|
21
|
+
|
|
22
|
+
export { omit };
|