A tiny library to calculate roll dices using the classic D&D sintax: 1d20+4.
Just load and execute the function:
import roll from "dice-roller";
const result = roll("2d4+1d8+3");
const picked = roll("4d6").pick(3);
The returned function is something like this:
{
"result": 14,
"dices": {
"d4": [2,3],
"d8": [6]
},
"bonus": 3
}
Run the commands:
yarn # install dependencies
yarn test # run tests