JSPM

@stacon/roll

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q22259F
  • License MIT

A functions than can emulate the roll of dice with custom dimensions

Package Exports

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

Readme

Roll

A simple program that emulates dice rolls with custom number of dimensions and times rolled. Like rolling 5d20 but with a function.

Usage

import Roll, { d, sum } from '@stacon/roll'

// Create a die
const D20 = d(20);

// Sigle die roll
console.log(Roll(D20)) // should log a number between 1 - 20 like a d20 roll would.

// Multiple dice roll of the same dimensions
const resultsArr = Roll.times(5)(D20) // returns an array of numbers between 1 - 20
console.log(resultsArr) // should log e.g [ 19, 20, 1, 5, 11 ]
console.log(sum(resultsArr)) // should return the sum of results are e.g. 56