tatuka-components
Version:
this is a readme text
19 lines • 715 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.calculatePercentage = exports.getRandomNumber = void 0;
function getRandomNumber(from, to) {
if (from > to) {
throw new Error('Invalid input parameters. The `from` parameter must be less than or equal to the `to` parameter.');
}
var randomNumber = Math.floor(Math.random() * (to - from + 1)) + from;
return randomNumber;
}
exports.getRandomNumber = getRandomNumber;
function calculatePercentage(part, total) {
if (total === 0) {
throw new Error('Total cannot be zero');
}
return (part * total) / 100;
}
exports.calculatePercentage = calculatePercentage;
//# sourceMappingURL=math.js.map