Sha256: 529b8688e675c4596d6f30663fdd853e124b933ba621d75052ec6b45a28a88d1
Contents?: true
Size: 879 Bytes
Versions: 9
Compression:
Stored size: 879 Bytes
Contents
const AbstractHandler = require("./AbstractHandler"); class GetTypeHandler extends AbstractHandler { requiredParametersCount = 1 constructor() { super() } process(command) { try { if (command.payload.length < this.requiredParametersCount) { throw new Error("Get Type parameters mismatch") } const {payload} = command let typeName = payload[0] typeName = typeName.replace(".js", "") let type = global[typeName] if (type === undefined) { throw new Error(`Cannot load ${typeName}`) } else { return type } } catch (error) { throw this.process_stack_trace(error, this.constructor.name) } } } module.exports = new GetTypeHandler()
Version data entries
9 entries across 9 versions & 1 rubygems