Just Die
Just a die roller library written in ES6 ES2015, use for whatever obscure purpose.
Installation
npm install --save justdie
To use directly in the browser:
or the minified version:
Build
On install a Node compliant index.js
will be created automatically:
npm install
but you can run it manually as well to create a index.js
:
npm run build
Documentation
Single die
Create a die and roll it:
let die6 = ; // 1-6
Or use the roll function
let die6 = ;; // 1-6
Dice pools
The roll function can take a pool of dice:
; // 3-30
and ofc mixed dice pools:
; // 3-24
Verbose rolls
You can make more verbose rolls:
let d20 = ;; // { "result": 1-20, "minmax": [1, 20], "sides": 20 }; // [{ "result": 1-20, "minmax": [1, 20], "sides": 20 }, ...]
Roll modifiers
You can supply simple modifiers to any die
; // 3-10; // 5-10; // 0-2; // 0-57
Note that when using negative modifiers we allow zero (0) as result.
Running The Test Suite
In the terminal run:
npm test
FAQ
- (
?
) But couldn't all this be achieved using a random_num util? - (
!
) You are correct, it could! And you are boring. Please stop talking.
Disclaimer
This project is currently in development state. Use at your own risk.
License
MIT