Sha256: eac3c855105d6c894557ad276d3c7c3c0f847d1b7ecea3e5aa63272bd51be0a2
Contents?: true
Size: 924 Bytes
Versions: 3
Compression:
Stored size: 924 Bytes
Contents
const AbstractHandler = require("./AbstractHandler"); class CreateClassInstanceHandler extends AbstractHandler { constructor() { super() } requiredParametersCount = 1 process(command) { try { if (command.payload.length < this.requiredParametersCount) { throw new Error("Create Class Instance parameters mismatch") } let clazz = command.payload[0] let constructorArguments = command.payload.slice(1) let instance = new clazz(...constructorArguments) if (typeof(instance) == 'undefined') { throw "Instance cannot be created" } else { return instance } } catch (error) { throw this.process_stack_trace(error, this.constructor.name) } } } module.exports = new CreateClassInstanceHandler()
Version data entries
3 entries across 3 versions & 1 rubygems