Sha256: 1a8bee1ea58b02262a2f7cbb61e941f12cae022f8cd6edae67bfe77d1cc1582e
Contents?: true
Size: 1.14 KB
Versions: 5
Compression:
Stored size: 1.14 KB
Contents
const AbstractHandler = require("./AbstractHandler"); const NamespaceCache = require("../namespaceCache/NamespaceCache"); class EnableNamespaceHandler extends AbstractHandler { constructor() { super() this.requiredParametersCount = 1 } process(command) { try { if (command.payload.length < this.requiredParametersCount) { throw new Error(this.constructor.name + " parameters mismatch") } const namespace_cache = new NamespaceCache(); for (let payload of command.payload) { if (typeof payload === 'string') { namespace_cache.cacheNamespace(payload); } if (Array.isArray(payload)) { for (let namespace_to_enable of payload) { namespace_cache.cacheNamespace(namespace_to_enable); } } } return 0; } catch (error) { throw this.process_stack_trace(error, this.constructor.name) } } } module.exports = new EnableNamespaceHandler()
Version data entries
5 entries across 5 versions & 1 rubygems