Skip to content

Commit f3df71c

Browse files
committed
add docs comment to roll
1 parent 0d134c4 commit f3df71c

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

source/library/roll.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
/**
2+
* Rolls a specified number of dice with a given number of sides and returns the results and total.
3+
*
4+
* @param {string} dice - The dice notation string (e.g., "2d6" for rolling two six-sided dice).
5+
* @returns {{ results: number[], total: number }} An object containing an array of individual roll results and their total sum.
6+
* @example
7+
* roll("3d4"); // { results: [2, 4, 1], total: 7 }
8+
*/
19
export default function roll(dice) {
210
const [quantity, sides] = dice.split("d").map((x) => parseInt(x));
311

0 commit comments

Comments
 (0)