$ npm i @idlework/dice --save
import Dice from 'dice'
export default class Map extends Dice {
constructor (dice, faces) {
super(dice, faces)
}
}
or
import Dice from 'dice'
const dice = new Dice(2, 6)
or
const Dice = require('dice')
const dice = new Dice(2, 6)
Intitialize Dice class.
dice
Number Number corresponding with the amount of dice.faces
Number Number corresponding with the amount of faces on the dice.
Roll the dice.
Returns Number Returns the total of all dice.
Clears the tray from dice. Result and tray will be cleared.
Return the amount of dice.
Returns Number Return the amount of dice.
Returns the amount of faces on a the dice.
Returns Number Returns the amount of faces on a the dice.
Returns the total of all the dice.
Returns Number Returns the total of all the dice.
Returns the tray(array) with all the dice.
Returns Array Return an array with all the dice.
Issues are welcome. The best way to report a problem is to reproduce it with a code example.
Pull requests are welcome. If you want to change the API, it's better to discuss it using an issue ticket.
Dice is MIT licensed.