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

2.0.2 • Public • Published

Funkydice

Roll all kinds of dice using string commands like 1d20+1

Supports all kinds of "dice", from 1d2 to 1d10000. Also supports Fate dice by using 4df and the d66 with 1d66

Usage

import { funkydie } from 'funkydice'
const result = funkydie('1d20+1')

The type of result is an object made with of the following type:

amount: number;
faces: number | "f";
modifier: number;
rolls: number[];
total: number;
totalUnmodified: number;

It's also possible to write multiple commands:

funkydice('1d6,2d8,9d30+2')

This will return an array of the result object above.

Package Sidebar

Install

npm i funkydice

Weekly Downloads

10

Version

2.0.2

License

MIT

Unpacked Size

8.79 kB

Total Files

5

Last publish

Collaborators

  • tjittedevries