1.1.0 • Published 5 years ago
rollexp v1.1.0
= rollexp Dardan Bujupaj
A simple module for evaluating common rpg dice expressions.
== Usage The module can be used as a js-library or as a node application from terminal.
=== JavaScript / Typescript
- install the package
npm install rollexp
- import and use the library source, javascript
import { evaluateExpression } from 'rollexp';
const { result, explanation } = evaluateExpression('1d20 + 5')
console.log('rolled a ' + result)
=== cli
Install the package via npm install rollexp
.
Roll a dice expression
source, bash
% roll 1d20 + 4
15
Roll an expression and show individual dice results.
source, bash
% roll --v 1d20 + 4