UNPKG

aztec

Version:

Node Js Framework for creating API Services

37 lines (36 loc) 972 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const handler_class_1 = require("./handler.class"); class Base { readonly(keys) { this.readOnlyKeys = keys; } set(key, value) { if (this.readOnlyKeys) { this.readOnlyKeys.forEach(roKey => { if (roKey !== key) { this[key] = value; } else { handler_class_1.Handler.userError(`svc.set(${key}, ${value}). "${key}" property is the internal variable, and cannot be overwritten. `); } }); } else { this[key] = value; } } get(key) { return this[key]; } enable(key) { this[key] = this[`${key}-disabled`]; delete this[`${key}-disabled`]; } disable(key) { this[`${key}-disabled`] = this[key]; delete this[key]; } } exports.Base = Base;