JSPM

ya-roll

0.1.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 8
  • Score
    100M100P100Q36344F
  • License BSD

Yet Another dice Rolling module

Package Exports

  • ya-roll

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 (ya-roll) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

ya-roll

Yet Another dice Rolling module.

There are many excellent dice rolling modules out there. You should probably check them out. I decided to write my own mainly to play around with building a chainable API.

var Roll = require('ya-roll');

var check = Roll(10).orAbove().onDice(3).withSides(6);

console.log("Probability of passing check: " + check.chance());

if (check.result()) {
  console.log("You pass!");
} else {
  console.log("You fail!");
}

var manyResults = check.results(10);
for (var i = 0; i < manyResults.length; ++i) {
  console.log("Check " + i + ": " + (manyResults[i] ? "passed" : "failed"));
}