@kamen/create-webapp 1.0.31 → 1.0.33

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 +16 -13
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -11,24 +11,27 @@ $ npm init @kamen/webapp
11
11
  ### Basic example
12
12
 
13
13
  ```js
14
- import {randomFromRange, randomFromList} from '@kamen/create-webapp';
14
+ import {createRandomFromRange, createRandomFromList, createRandomColorFromSaturationLightnessAlpha} from '@kamen/create-webapp';
15
+
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
23
  const ageHandler = createRandomFromRange(0, 99);
17
24
  const colorHandler = createRandomFromList(['red', 'green', 'blue']);
18
- const stateHandler = createRandomFromRange(0, 1);
19
- const identUpperCaseHandler = createRandomFromRange(65, 90);
20
- const identLowerCaseHandler = createRandomFromRange(97, 122);
21
- const stateHandlerFormat = () => Boolean(stateHandler());
22
- const identHandlerFormat = () => String.fromCharCode(stateHandler() ? identUpperCaseHandler() : identLowerCaseHandler());
25
+ const stateHandler = createRandomFromList([true, false]);
26
+ const identHandler = createRandomFromList(characters);
27
+ const identFormatHandler = () => Array.from({length: 1 << 5}, identHandler).join('');
23
28
 
24
29
  const data = Array.from({length: 1 << 8}, (_, index) => ({
25
- index,
26
- age: ageHandler(),
27
- color: colorHandler(),
28
- state: stateHandlerFormat(),
29
- ident: Array
30
- .from({length: 1 << 5}, identHandlerFormat)
31
- .join('')
30
+ index,
31
+ age: ageHandler(),
32
+ color: colorHandler(),
33
+ state: stateHandler(),
34
+ ident: identFormatHandler()
32
35
  }));
33
36
 
34
37
  console.dir(data);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kamen/create-webapp",
3
- "version": "1.0.31",
3
+ "version": "1.0.33",
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",