UNPKG

lisk-framework

Version:

Lisk blockchain application platform

38 lines 992 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.NamedRegistry = void 0; class NamedRegistry { constructor() { this._registry = new Map(); } register(key, value) { this._registry.set(key, value); } get(key) { const named = this._registry.get(key); if (!named) { throw new Error(`Class ${key.name} is not registered.`); } return named; } keys() { const result = []; for (const klass of this._registry.values()) { result.push(klass.key); } return result; } values() { const result = []; for (const klass of this._registry.values()) { result.push({ name: klass.name, key: klass.key, schema: klass.schema, }); } return result; } } exports.NamedRegistry = NamedRegistry; //# sourceMappingURL=named_registry.js.map