UNPKG

@ayanaware/bento

Version:

Modular runtime framework designed to solve complex tasks

53 lines 1.65 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.PropertyManager = void 0; const errors_1 = require("@ayanaware/errors"); class PropertyManager { constructor() { this.properties = new Map(); } /** * Checks if a given property exists in bento * @param name property name * * @returns boolean */ hasProperty(name) { if (typeof name !== 'string') throw new errors_1.IllegalArgumentError('Property name must be a string'); return this.properties.has(name); } /** * Fetch a value for given application property * @param name name of variable to get * * @returns Property value */ getProperty(name) { if (typeof name !== 'string') throw new errors_1.IllegalArgumentError('Property name must be a string'); return this.properties.get(name); } /** * Update a given application property value * @param name name of variable to update * @param value new value */ setProperty(name, value) { if (typeof name !== 'string') throw new errors_1.IllegalArgumentError('Property name must be a string'); this.properties.set(name, value); return value; } /** * Define multiple application properties at once * @param properties SetProperties object */ setProperties(properties) { for (const [name, value] of Object.entries(properties)) { this.setProperty(name, value); } } } exports.PropertyManager = PropertyManager; //# sourceMappingURL=PropertyManager.js.map