2.0.0 • Published 3 years ago

@olian/dice-roller v2.0.0

Weekly downloads
6
License
MIT
Repository
github
Last release
3 years ago

dice-roller

Tiny Dice Rolling POC

Usage

Can be used in 2 different ways:

  1. Install it as a node js library
  2. Install it as a shell command

Install (library)

npm i @olian/dice-roller
const { rollDice } = require('@olian/dice-roller');

const input = '2d4 + 2 + d6';
console.log(input);
const result = rollDice(input);
console.log(result.values.join(' + '), '=', result.sum);

Install (shell command)

$ sudo npm i -g @olian/dice-roller
$ roll 2d4 + 2 + d6
2d4 + 2 + d6
3 + 4 + 2 + 2 = 11

Syntax

Input string can be any combination of dice including static rolls.

Ex:

  • 2d6
  • 3d4 + 3
  • 2d10 + 4d9 + 2
  • d20
  • d20 d20 d20
  • d3 2d5 d10 + 6
2.0.0

3 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.0

4 years ago