pengrape
A collection of utilities generating anything random.
Overview
Pengrape provides 8 different utilities which include generating random number, color, palette, password, spinner, dice, text and date. Their behavior can be customized by providing different arguments.
Installation
$ npm install pengrape
Usage
const random = require("pengrape");
Generate a result
You can use the available methods to generate a random result according to your preferences.
random.number({ min: 10, max: 20 }); // 17
Construct results
To generate multiple results, you can use the construct option in any methods you want.
random.number({ min: 10, max: 20, construct: 4 }); // [12, 14, 10, 19]
Examples
Color
const color = random.color({ format: "hex" });
console.log(color); // "#f28e51"
Dice
const dice = random.dice({ notation: "2d10" });
console.log(dice); // { results: [ 4, 9 ], total: 13 }
Date
const date = random.date({ dateStart: [2021, 1, 1], dateEnd: [2021, 6, 17] });
console.log(date); // "2021-04-29"
Full docs
See the full docs for details and examples.
Issues
If any issues are found, they can be reported here.
License
This project is licensed under the MIT license.