node package manager

rollin

Roll dice from the command line using D&D-style syntax

rollin (urban assault vehicle, natch)

A little library for doing dice rolls.

npm install rollin

From inside node:

const roll = require('rollin');
 
console.log(roll('3d6'));
console.log(roll('d8'));
console.log(roll('12d4+2'));
console.log(roll('d100+12'))

From the cli:

josh@pidgey:~$ roll 3d6+2
9

Commands are of the form {number_of_dice}d{sides_of_die}[+/-{some_modifier}]. Spaces are stripped, otherwise the DSL is pretty limited.

npm test