m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/src/dice.js
diff options
context:
space:
mode:
authorMarcin Chrzanowski <marcin.j.chrzanowski@gmail.com>2017-09-11 15:47:50 -0400
committerMarcin Chrzanowski <marcin.j.chrzanowski@gmail.com>2017-09-11 15:47:50 -0400
commit9368b1c33db290d7c80c93db5c867cdb7fcaf14d (patch)
treec6170c157985624b373a13bb540bd4070321c18c /src/dice.js
parentda6582f328c17e1842a4632d88e06d851e7c4b5f (diff)
Implement collecting
Diffstat (limited to 'src/dice.js')
-rw-r--r--src/dice.js5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/dice.js b/src/dice.js
index 0197f25..1e15937 100644
--- a/src/dice.js
+++ b/src/dice.js
@@ -222,6 +222,10 @@ const repeat = (die1, die2) => {
}
}
+const collect = die => {
+ return () => [() => roll(die)]
+}
+
exports.pool = pool
exports.roll = roll
exports.constant = constant
@@ -244,3 +248,4 @@ exports.againUnder = againUnder
exports.thresholdHigh = thresholdHigh
exports.thresholdLow = thresholdLow
exports.repeat = repeat
+exports.collect = collect