@kamen/create-webapp 1.0.15 → 1.0.17

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 (3) hide show
  1. package/README.md +16 -1
  2. package/index.js +11 -0
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -1,9 +1,24 @@
1
1
  # @kamen/create-weapp <a href="https://npmjs.com/package/@kamen/create-webapp"><img src="https://img.shields.io/npm/v/@kamen/create-webapp" alt="npm package"></a>
2
2
 
3
- ## Scaffolding Your Project
3
+ ## Project Scaffolding
4
4
 
5
5
  With NPM:
6
6
 
7
7
  ```bash
8
8
  $ npm init @kamen/webapp
9
9
  ```
10
+
11
+ ## Utility Functions
12
+
13
+ ```js
14
+ import {randomFromRange, randomFromList} from "@kamen/create-webapp";
15
+
16
+ const colors = ['red', 'green', 'blue'];
17
+ const data = {
18
+ color: randomFromList(colors),
19
+ length: randomFromRange(0, 99);
20
+ state: Boolean(randomFromRange(0, 1))
21
+ };
22
+
23
+ console.dir(data);
24
+ ```
package/index.js CHANGED
@@ -62,4 +62,15 @@ export function randomFromRange(min = 0, max = 255) {
62
62
  */
63
63
  export function randomFromList(list = []) {
64
64
  return list[randomFromRange(0, list.length - 1)];
65
+ }
66
+
67
+ /**
68
+ * @param {number} [saturation=80]
69
+ * @param {number} [lightness=80]
70
+ * @param {number} [alpha=1]
71
+ * @returns {string}
72
+ */
73
+ export function randomColorFromSaturationLightnessAlpha(saturation = 80, lightness = 80, alpha = 1) {
74
+ const hue = randomFromRange(0, 359);
75
+ return `hsla(${hue}, ${saturation}%, ${lightness}%, ${alpha})`;
65
76
  }
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@kamen/create-webapp",
3
- "version": "1.0.15",
3
+ "version": "1.0.17",
4
4
  "description": "npm init @kamen/webapp",
5
5
  "homepage": "https://www.npmjs.com/package/@kamen/create-webapp",
6
- "license": "UNLICENSED",
6
+ "license": "GPL-2.0-only",
7
7
  "private": false,
8
8
  "keywords": ["init", "utlity", "web"],
9
9
  "type": "module",