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

2.0.2 • Public • Published

Dicewerx

npm package for handling standard dice notation

npm (tag) npm (tag) GitHub npm

GitHub issues Build Status Greenkeeper badge

Codacy Badge Maintainability Test Coverage

A standard dice notation parser and evaluator. Can handle standard dice notation expressions and returns the results of the expression as a number.

Examples

evaluate("1d20") # Rolls one d20
evaluate("4d6-L") # Rolls 4 d6 and drops the lowest result
evaluate("4d4*10") # Rolls 4 d4 and multiples the result by 10
evaluate("4d6-L+50") # Rolls 4 d6, drops the lowest, then adds 50 to the result
evaluate("1d20!") # Rolls 1 d20, rolling again on a 20
evaluate("4d6!-5") # Rolls 4 d6, rolling again on a 6 then subtracting 5 from the result

Getting Started

See the getting started guide here.

Roadmap

  • Nested expression support (multiple expressions in one expression)

Documentation

Current documentation is available here.

Package Sidebar

Install

npm i dicewerx

Weekly Downloads

0

Version

2.0.2

License

MIT

Unpacked Size

19.2 kB

Total Files

14

Last publish

Collaborators

  • codemastermick