Skip to content

Commit

Permalink
55 - doc update
Browse files Browse the repository at this point in the history
  • Loading branch information
b5414 committed Nov 3, 2020
1 parent 688cf8c commit 95b4e29
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ console.log(roll()); // 13
- [Randomizers](#randomizers)
- [.roll()](#roll)
- [.dice()](#dice)
- [.slot()](#slot)
- [.randomElement() = .oneOfArray()](#randomelement--oneofarray)
- [.randomObjElement() = .oneOfObject()](#randomobjelement--oneofobject)
- [.randomObjValue() = .oneValueOfObject()](#randomobjvalue--onevalueofobject)
Expand Down Expand Up @@ -318,6 +319,57 @@ Visual only for 1-6 (Default), else - `false`
/
-->

#### .slot()

Will return 2x`array` and `object` in, with **index** and **visual** keys

Syntax

```js
rand.slot([spins = 1[, reels = 3[, visual = false]]]);
// if(!visual)visual = ['🍒', '🍎', '🍋', '🍑', '🍇', '🍉', '🥭', '🍓', '🍐'];
```

| params | description | type | value | default value | optional |
| -------- | ----------------------------------------------- | -------- | ----- | ------------------- | -------- |
| `spins` | Suitable for animations OR if slot machines > 1 | `number` | 1-999 | 1 | + |
| `reels` | Number of reels (cylinders with fruits) | `number` | 1-999 | 3 | + |
| `visual` | Reels content (for example fruits) | `array` | 1-999 | _fruits_ (length 9) | + |

Examples

```js
rand.slot(); /* [[
{index: 2, visual: '🍋'},
{index: 7, visual: '🍓'},
{index: 8, visual: '🍐'},
]] */
rand.slot(); /* [[
{index: 4, visual: '🍇'},
{index: 7, visual: '🍓'},
{index: 1, visual: '🍎'},
], [
{index: 7, visual: '🍓'},
{index: 2, visual: '🍋'},
{index: 6, visual: '🥭'},
]] */
rand.slot(1, 2, ['a', 'b', '🥰']); /* [[
{index: 2, visual: '🥰'},
{index: 1, visual: 'b'},
]] */
```

---

<!--
\
/
\
/
\
/
-->

#### .randomElement() = .oneOfArray()

Will return `value` element, from given **array**
Expand Down

0 comments on commit 95b4e29

Please sign in to comment.