extra-random-addon 1.0.2 → 1.0.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/README.md +76 -17
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,19 +1,78 @@
|
|
|
1
|
-
extra-random-addon
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
#extra-random-addon
|
|
2
|
+
|
|
3
|
+
A simple package with simple "random" functions.
|
|
4
|
+
|
|
5
|
+
##How to Install
|
|
6
|
+
|
|
7
|
+
Install the package using npm:
|
|
8
|
+
|
|
9
|
+
```npm install extra-random-addon```
|
|
10
|
+
|
|
11
|
+
##Usage
|
|
12
|
+
|
|
13
|
+
Import the functions you need:
|
|
14
|
+
|
|
15
|
+
```import {randint,minimum,maximum,randrandint,rand_colour_rgb,rand_colour_hex,choice} from "extra-random-addon"```
|
|
16
|
+
|
|
17
|
+
##API
|
|
18
|
+
###randint(min, max)
|
|
19
|
+
|
|
20
|
+
Returns a random integer between min and max, including both values.
|
|
21
|
+
|
|
22
|
+
```randint(1, 10);```
|
|
23
|
+
|
|
24
|
+
###minimum
|
|
25
|
+
|
|
26
|
+
A shorthand constant for:
|
|
27
|
+
|
|
28
|
+
```-999999999999999```
|
|
29
|
+
|
|
30
|
+
###maximum
|
|
31
|
+
|
|
32
|
+
A shorthand constant for:
|
|
33
|
+
|
|
34
|
+
```999999999999999```
|
|
35
|
+
|
|
36
|
+
###randrandint()
|
|
37
|
+
|
|
38
|
+
Returns a random integer where both the minimum and maximum values are themselves randomly generated using randint().
|
|
39
|
+
|
|
40
|
+
```randrandint();```
|
|
41
|
+
|
|
42
|
+
###rand_colour_rgb()
|
|
43
|
+
|
|
44
|
+
Returns a random RGB colour. Each value is generated using randint(0, 255).
|
|
45
|
+
|
|
46
|
+
```rand_colour_rgb();```
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
For example:
|
|
50
|
+
|
|
51
|
+
```[124, 37, 201]```
|
|
52
|
+
|
|
53
|
+
###rand_colour_hex()
|
|
54
|
+
|
|
55
|
+
Returns a random 7-character hexadecimal colour code.
|
|
56
|
+
|
|
57
|
+
```rand_colour_hex();```
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
For example:
|
|
61
|
+
|
|
62
|
+
```#7fc2a1```
|
|
63
|
+
|
|
64
|
+
###choice(array)
|
|
65
|
+
|
|
66
|
+
Returns a random item from the provided array.
|
|
67
|
+
|
|
68
|
+
```choice(["apple", "banana", "orange"]);```
|
|
69
|
+
|
|
70
|
+
##Licence
|
|
71
|
+
|
|
17
72
|
ISC
|
|
18
73
|
|
|
19
|
-
¹ yes it's spelt
|
|
74
|
+
¹ yes, it's spelt "colour", not "color".
|
|
75
|
+
|
|
76
|
+
##PS
|
|
77
|
+
|
|
78
|
+
I had to release a couple of versions just to get this layout right.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "extra-random-addon",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "Some extra 'random' features to make coders' lives easier.",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"files": [
|
|
@@ -22,6 +22,6 @@
|
|
|
22
22
|
"license": "ISC",
|
|
23
23
|
"type": "module",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"extra-random-addon": "^1.0.
|
|
25
|
+
"extra-random-addon": "^1.0.3"
|
|
26
26
|
}
|
|
27
27
|
}
|