Sha256: 4bc8b956acfab101069f1760799fdeef0b8257babc35cf4e5a2b8d05f3120272
Contents?: true
Size: 793 Bytes
Versions: 14
Compression:
Stored size: 793 Bytes
Contents
const AbstractHandler = require('./AbstractHandler') class LoadLibraryHandler extends AbstractHandler { constructor() { super() } process(command) { let {payload} = command let [lib] = payload let pathArray = lib.split(/[/\\]/) let libraryName = pathArray.length > 1 ? pathArray[pathArray.length - 1] : pathArray[0] libraryName = libraryName.replace('.js', '') try { global[libraryName] = require(lib) } catch (error) { try { global[libraryName] = require(`${process.cwd()}/${lib}`) } catch { return this.process_stack_trace(error, this.constructor.name) } } return 0 } } module.exports = new LoadLibraryHandler()
Version data entries
14 entries across 7 versions & 1 rubygems