mirror of
https://github.com/SrIzan10/rockpaperscissors-checker.git
synced 2026-06-06 00:57:05 +00:00
feat: make it esm
This commit is contained in:
16
index.js
16
index.js
@@ -1,17 +1,4 @@
|
||||
"use strict";
|
||||
/**
|
||||
* @example
|
||||
* // should return player1 (the winner)
|
||||
* rockpaperscissors(2, 1)
|
||||
* @example
|
||||
* // should return tie (it's a tie)
|
||||
* rockpaperscissors(1, 1)
|
||||
* @description Main function, you need to pass 2 numbers.
|
||||
* @param {number} player1 1 for rock, 2 for paper, 3 for scissors
|
||||
* @param {number} player2 1 for rock, 2 for paper, 3 for scissors
|
||||
* @returns {string} either "player1", "player2" (whoever won) or "tie" for a tie.
|
||||
*/
|
||||
exports.__esModule = true;
|
||||
function rockpaperscissors(player1, player2) {
|
||||
if (player1 === player2) {
|
||||
return "tie";
|
||||
@@ -38,4 +25,5 @@ function rockpaperscissors(player1, player2) {
|
||||
throw new Error("Make sure player1 and player2 have right numbers.");
|
||||
}
|
||||
}
|
||||
exports["default"] = rockpaperscissors;
|
||||
export const __esModule = true;
|
||||
export default rockpaperscissors;
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
{
|
||||
"name": "rockpaperscissors-checker",
|
||||
"version": "1.1.2",
|
||||
"version": "1.2.0",
|
||||
"description": "check for ties and wins on rockpaperscissors",
|
||||
"main": "index.js",
|
||||
"type": "module",
|
||||
"main": "./index.js",
|
||||
"scripts": {
|
||||
"test": "node ."
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user