1.0.2 • Published 8 years ago
uvk v1.0.2
uvk
a small set of shared js utility functions, with no dependencies.
How to install
yarn add uvkHow to use it
const uvk = require('uvk);
uvk.range(5).map(_ => console.log("this will be executed 5 times"));
uvk.randomizer.dice(); // this will roll a 6 faced diceRandomizer
A set of function to work with randomness
pickOne
Get a random element from an array
const randomizer = require('uvk').randomizer;
randomizer.pickOne([1,2,3]); // > 2int
Get a random integer number, between low and high
const randomizer = require('uvk').randomizer;
const LOW = 2;
const HIGH = 8;
randomizer.int(LOW, HIGH); // > 4chance
Get a boolean related to a chance in percentage
const randomizer = require('uvk').randomizer;
randomizer.chance(90); // > 90% of the times this will be truedice
Roll a dice of X number of faces (6 by default)
const randomizer = require('uvk').randomizer;
randomizer.dice(); // > 4Utils
Set of small text and number utils that I use between projects
Consts
Set of Consts
