-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
30 lines (25 loc) · 912 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
//----------------------------------------------------------------------------------------------------------------------
// RPGDice
//----------------------------------------------------------------------------------------------------------------------
const { parse } = require('./lib/parser');
const { rollDie } = require('./lib/rolldie');
//----------------------------------------------------------------------------------------------------------------------
module.exports = {
parse(expr)
{
return parse(expr);
},
eval(expr, scope)
{
if(typeof expr === 'string')
{
expr = parse(expr);
} // end if
return expr.eval(scope);
},
rollDie(sides)
{
return rollDie(sides);
}
}; // end exports
//----------------------------------------------------------------------------------------------------------------------