@mateo-wallace/rpg-dice-js
Version:
Npm package that allows users to roll dice with all math and various forms of response
24 lines (23 loc) • 976 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var _Dice = _interopRequireDefault(require("./models/Dice.js"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
/**
* Call the roll method of the dice class.
* @param {string} userInput - The user input for the dice roll.
* @param {Object} diceSettings - The settings for the Dice Class.
* @return {Object} The result of the dice roll.
*/
var roll = function roll(userInput, diceSettings) {
if (diceSettings === undefined) diceSettings = {};
var type = Object.prototype.toString.call(diceSettings).slice(8, -1);
if (type !== "Object") throw new Error("Settings must be an object X ".concat(type));
return new _Dice["default"](diceSettings).roll(userInput);
};
var _default = exports["default"] = roll; // For CommonJS compatibility
if (typeof module !== "undefined" && module.exports) {
module.exports = roll;
}