With the module below, how can I add functions to it which are not public? This isn't the revealing module. Suppose I don't want roll to be public? Not saying that is correct as roll is useful. But how to hide it?
/* global module */
module.exports = (function () {
'use strict';
var random;
function Dice(random) {
this.init(random);
}
Dice.prototype.init = function (random) {
this.random = random || Math.random
};
Dice.prototype.d20 = function() {
var max = 20;
var min = 1;
return this.roll(min, max);
};
Dice.prototype.d6 = function() {
var max = 6;
var min = 1;
return this.roll(min, max);
};
Dice.prototype.roll = function(min, max) {
return Math.floor(this.random() * (max - min)) + min;
};
return Dice;
}());