Sha256: 0801d790809f44752803c6468ab86a063c57091210c7033731abd343fc82236e
Contents?: true
Size: 925 Bytes
Versions: 4
Compression:
Stored size: 925 Bytes
Contents
const AbstractHandler = require("./AbstractHandler"); class CreateClassInstanceHandler extends AbstractHandler { requiredParametersCount = 1 constructor() { super() } 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
4 entries across 4 versions & 1 rubygems