@kamen/create-webapp
v1.0.38
Published
npm init @kamen/webapp
Downloads
1,837
Readme
@kamen/create-webapp
Project Scaffolding (wip)
$ npm init @kamen/webapp
Utility Functions
Basic example
import {
createRandomFromRange,
createRandomFromList,
createRandomColorFromSaturationLightnessAlpha
} from '@kamen/create-webapp';
const characters = Array
.from({length: 26}, (_, index) => [
String.fromCharCode(65 + index),
String.fromCharCode(97 + index)
])
.flat();
const ageHandler = createRandomFromRange(0, 99);
const colorHandler = createRandomFromList(['red', 'green', 'blue']);
const stateHandler = createRandomFromList([true, false]);
const identHandler = createRandomFromList(characters);
const identFormatHandler = () => Array
.from({length: 1 << 5}, identHandler)
.join('');
const data = Array
.from({length: 1 << 8}, (_, index) => ({
index,
age: ageHandler(),
color: colorHandler(),
state: stateHandler(),
ident: identFormatHandler()
}));
console.dir(data);