simple-rps

1.0.1 • Public • Published

simple-rps

A package that takes two moves for rock paper scissors and determines the winner.

Documentation

/**
 * Generates the winner.
 * @param {String} move_player1 - The move of the first player.
 * @param {String} move_player2 - The move of the second player.
 * @returns {Object} An object containing data on the game round.
 */
module.exports = function(move_player1, move_player2) {
  // ...
}

Examples

const rps = require("simple-rps");
console.log(rps("rock", "scissors"));
/*
{
  result: { success: true, message: 'player1 won' },
  player1: { move: 'rock', result: 'won' },
  player2: { move: 'scissors', result: 'lost' }
}
*/

Readme

Keywords

none

Package Sidebar

Install

npm i simple-rps

Weekly Downloads

2

Version

1.0.1

License

ISC

Unpacked Size

3 kB

Total Files

4

Last publish

Collaborators

  • thwampusthewumpus