@devcycle/js-cloud-server-sdk
Version:
The DevCycle JS Cloud Bucketing Server SDK used for feature management.
25 lines • 1.11 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.DVCVariable = void 0;
const paramUtils_1 = require("../utils/paramUtils");
class DVCVariable {
constructor(variable) {
const { key, defaultValue, value, eval: evalReason, type } = variable;
(0, paramUtils_1.checkParamDefined)('key', key);
(0, paramUtils_1.checkParamDefined)('defaultValue', defaultValue);
(0, paramUtils_1.checkParamType)('key', key, paramUtils_1.typeEnum.string);
// kind of cheating here with the type assertion but we're basically assuming that all variable keys in
// generated types are lowercase since the system enforces that elsewhere
this.key = key.toLowerCase();
this.isDefaulted = value === undefined || value === null;
this.value =
value === undefined || value === null
? defaultValue
: value;
this.defaultValue = defaultValue;
this.eval = evalReason;
this.type = type;
}
}
exports.DVCVariable = DVCVariable;
//# sourceMappingURL=variable.js.map