unleash-client
Version:
Unleash Client for Node
18 lines • 761 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const strategy_1 = require("./strategy");
class GradualRolloutRandomStrategy extends strategy_1.Strategy {
constructor(randomGenerator) {
super('gradualRolloutRandom');
this.randomGenerator = () => Math.floor(Math.random() * 100) + 1;
this.randomGenerator = randomGenerator || this.randomGenerator;
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
isEnabled(parameters, context) {
const percentage = Number(parameters.percentage);
const random = this.randomGenerator();
return percentage >= random;
}
}
exports.default = GradualRolloutRandomStrategy;
//# sourceMappingURL=gradual-rollout-random.js.map