miniroll
TypeScript icon, indicating that this package has built-in type declarations

0.2.2 • Public • Published

miniroll

A simple JS library for rolling dice

Installation

npm i miniroll
yarn add miniroll

Usage

const { roll, describe, describeShort } = require('miniroll')

const dice = '4d6dL'

describe(dice)
// 'roll 4 6-sided dice and drop the lowest'

describeShort(dice)
// '4d6dL'

roll(dice)
/*
  {
    result: 14,
    rolls: [ 5, 6, 3 ],
    dropped: [ 3 ],
    source: '4d6dL',
    rollData: {
      count: 4,
      sides: 6,
      select: { mode: 'drop', end: 'lowest', count: 1 }
    }
  }
*/

Readme

Keywords

none

Package Sidebar

Install

npm i miniroll

Weekly Downloads

6

Version

0.2.2

License

MIT

Unpacked Size

10.3 kB

Total Files

6

Last publish

Collaborators

  • fergcb