Get unlimited public & private packages + package-based permissions with npm Pro.Get started »

@idlework/dice

1.0.0 • Public • Published

Dice

Installation

$ npm i @idlework/dice --save

Usage

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)

API

constructor

Intitialize Dice class.

Parameters

  • dice Number Number corresponding with the amount of dice.
  • faces Number Number corresponding with the amount of faces on the dice.

roll

Roll the dice.

Returns Number Returns the total of all dice.

clearTray

Clears the tray from dice. Result and tray will be cleared.

dice

Return the amount of dice.

Returns Number Return the amount of dice.

faces

Returns the amount of faces on a the dice.

Returns Number Returns the amount of faces on a the dice.

result

Returns the total of all the dice.

Returns Number Returns the total of all the dice.

tray

Returns the tray(array) with all the dice.

Returns Array Return an array with all the dice.

Contributing

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.

License

Dice is MIT licensed.

Install

npm i @idlework/dice

DownloadsWeekly Downloads

3

Version

1.0.0

License

MIT

Unpacked Size

7.57 kB

Total Files

6

Last publish

Collaborators

  • avatar