@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.
Files changed (2) hide show
  1. package/README.md +26 -11
  2. 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 "@kamen/create-webapp";
14
+ import {randomFromRange, randomFromList} from '@kamen/create-webapp';
13
15
 
14
- const colors = ['red', 'green', 'blue'];
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(colors);
19
-
20
- const data = Array.from({length: 1 << 6}, (_, index) => ({
21
- index,
22
- state: Boolean(stateHandler()),
23
- age: ageHandler(),
24
- color: colorHandler()
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
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kamen/create-webapp",
3
- "version": "1.0.30",
3
+ "version": "1.0.32",
4
4
  "description": "npm init @kamen/webapp",
5
5
  "homepage": "https://www.npmjs.com/package/@kamen/create-webapp",
6
6
  "license": "GPL-2.0-only",