Package Exports
- rolling-dice
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (rolling-dice) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
rolling-dice
Small library providing possibility to imitate rolling of the dice with user-defined DiceExpressions.
Installation
npm install rolling-dice
Usage
DiceExpression
A DiceExpression is defined as follows:
DiceExpression => Integer
DiceExpression => x?(d|D)y where x is the # of dice and y the sides.
DiceExpression => x?(d|D)% where x is the # of dice and '%' = 100
DiceExpression => DiceExpression +/- DiceExpressionCode sample
DiceExpression = require('rolling-dice');
var de = new DiceExpression('2d10 + 8 - d%');
de.roll(); // 10
de.rollExplained(); // { total: -17, dice: [ 2, 1, 9, -29 ] }
de.max(); // 27
de.min(); // -90Tests
npm test
Release History
- 0.1.0 Initial release