Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

slot-machine

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

slot-machine - npm Package Compare versions

Comparing version 1.0.1 to 1.1.0

8

index.js

@@ -63,2 +63,3 @@ let Symbol = require('./symbol.js');

lines[i] = {symbols, win, points: symbols.reduce((a, b) => a + b.points, 0)};
lines[i].diagonal = false;

@@ -77,6 +78,11 @@ if (i === lines.length - 1 || i === lines.length - 2){

* @param lines - An array of arrays containing Symbols, or an array of rows containing points and results.
* @param includeDiagonals - Whether or not to include diagonals. Only works with calculated lines.
* @return A formatted slot machine game.
*/
module.exports.format = (lines) => {
module.exports.format = (lines, includeDiagonals = true) => {
if (lines.calculated){
if (!includeDiagonals){
lines = lines.filter((l) => !l.diagonal);
}
return lines.map((l) => l.symbols.map((s) => s.symbol).join(' ') + ' ' + (l.diagonal ? 'Diagonal ' : '') + (l.win ? 'Win!' : '')).join('\n');

@@ -83,0 +89,0 @@ }

{
"name": "slot-machine",
"version": "1.0.1",
"version": "1.1.0",
"description": "A functioning slot machine!",
"main": "index.js",
"keywords": ["slot machine", "slots", "gambling", "rng"],
"author": "1Computer",
"license": "MIT"
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/1Computer1/slot-machine.git"
},
"bugs": {
"url": "https://github.com/1Computer1/slot-machine/issues"
},
"homepage": "https://github.com/1Computer1/slot-machine"
}

15

README.md

@@ -1,2 +0,2 @@

Basic usage:
### Usage
```js

@@ -24,4 +24,4 @@ const slotMachine = require('slot-machine');

```
`Symbol(name, symbol[, points, weight, wildcard])`
### Documentation
##### `Symbol(name, symbol[, points = 1, weight = 1, wild = false])`
`name` A unique name.

@@ -31,5 +31,5 @@ `symbol` A symbol for display.

`weight` Chance of this Symbol appearing.
`wildcard` Match with any other Symbol.
`wild` Whether or not the Symbol can match with any other Symbol.
`play(symbols[, size])`
##### `play(symbols[, size = 3])`
`symbols` An array of Symbols.

@@ -39,8 +39,9 @@ `size` Grid size, will round to nearest odd number above 3.

`calculate(lines)`
##### `calculate(lines)`
`lines` An array of arrays containing Symbols.
Returns an array, containing the points and results of the lines inputted.
`format(lines)`
##### `format(lines[, includeDiagonals = true])`
`lines` An array of arrays containing Symbols, or calculated lines.
`includeDiagonals` Whether or not to include diagonals. Only works with calculated lines.
Returns a formatted slot machine game.
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc