UNPKG

hypertune

Version:

[Hypertune](https://www.hypertune.com/) is the most flexible platform for feature flags, A/B testing, analytics and app configuration. Built with full end-to-end type-safety, Git-style version control and local, synchronous, in-memory flag evaluation. Opt

83 lines 2.41 kB
"use strict"; /* eslint-disable max-classes-per-file */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.StringNode = exports.FloatNode = exports.IntNode = exports.BooleanNode = exports.VoidNode = void 0; const Node_1 = __importDefault(require("./Node")); class VoidNode extends Node_1.default { constructor() { super(...arguments); this.typeName = "Void"; } get(options = {}) { const value = this.getValue({ fallback: "fallback" }); if (value === true) { return; } this.logUnexpectedValueError(value); } } exports.VoidNode = VoidNode; class BooleanNode extends Node_1.default { constructor() { super(...arguments); this.typeName = "Boolean"; } get({ fallback }) { const value = this.getValue({ fallback }); if (typeof value === "boolean") { return value; } this.logUnexpectedValueError(value); return fallback; } } exports.BooleanNode = BooleanNode; class IntNode extends Node_1.default { constructor() { super(...arguments); this.typeName = "Int"; } get({ fallback }) { const value = this.getValue({ fallback }); if (typeof value === "number" && Number.isInteger(value)) { return value; } this.logUnexpectedValueError(value); return fallback; } } exports.IntNode = IntNode; class FloatNode extends Node_1.default { constructor() { super(...arguments); this.typeName = "Float"; } get({ fallback }) { const value = this.getValue({ fallback }); if (typeof value === "number") { return value; } this.logUnexpectedValueError(value); return fallback; } } exports.FloatNode = FloatNode; class StringNode extends Node_1.default { constructor() { super(...arguments); this.typeName = "String"; } get({ fallback }) { const value = this.getValue({ fallback }); if (typeof value === "string") { return value; } this.logUnexpectedValueError(value); return fallback; } } exports.StringNode = StringNode; //# sourceMappingURL=primitiveNodes.js.map