@kamen/create-webapp 1.0.30 → 1.0.32
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 +26 -11
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,21 +8,36 @@ $ npm init @kamen/webapp
|
|
|
8
8
|
|
|
9
9
|
## Utility Functions
|
|
10
10
|
|
|
11
|
+
### Basic example
|
|
12
|
+
|
|
11
13
|
```js
|
|
12
|
-
import {randomFromRange, randomFromList} from
|
|
14
|
+
import {randomFromRange, randomFromList} from '@kamen/create-webapp';
|
|
13
15
|
|
|
14
|
-
const
|
|
16
|
+
const characters = Array
|
|
17
|
+
.from({length: 26}, (_, index) => [
|
|
18
|
+
String.fromCharCode(65 + index),
|
|
19
|
+
String.fromCharCode(97 + index)
|
|
20
|
+
])
|
|
21
|
+
.flat();
|
|
15
22
|
|
|
16
|
-
const stateHandler = createRandomFromRange(0, 1);
|
|
17
23
|
const ageHandler = createRandomFromRange(0, 99);
|
|
18
|
-
const colorHandler = createRandomFromList(
|
|
19
|
-
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
const colorHandler = createRandomFromList(['red', 'green', 'blue']);
|
|
25
|
+
const stateHandler = createRandomFromList([true, false]);
|
|
26
|
+
const identHandler = createRandomFromList(characters);
|
|
27
|
+
const identFormatHandler = () => Array.from({length: 1 << 5}, identHandler).join('');
|
|
28
|
+
|
|
29
|
+
const data = Array.from({length: 1 << 8}, (_, index) => ({
|
|
30
|
+
index,
|
|
31
|
+
age: ageHandler(),
|
|
32
|
+
color: colorHandler(),
|
|
33
|
+
state: stateHandler(),
|
|
34
|
+
ident: identFormatHandler()
|
|
25
35
|
}));
|
|
26
36
|
|
|
27
37
|
console.dir(data);
|
|
28
|
-
```
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Advanced example
|
|
41
|
+
|
|
42
|
+
[SVG Path Generative Art](https://codepen.io/L1feF0rm/pen/GRzGxdb)
|
|
43
|
+
|