Skip to content

Instantly share code, notes, and snippets.

@paxperscientiam
Created January 1, 2020 04:10
Show Gist options
  • Save paxperscientiam/d0dba890796573dfcafddf0f738280c5 to your computer and use it in GitHub Desktop.
Save paxperscientiam/d0dba890796573dfcafddf0f738280c5 to your computer and use it in GitHub Desktop.
req
const path = require('path');
function Req(base) {
this.base = base;
}
Req.prototype.get = function(module, opts) {
if (typeof require(path.resolve(this.base, module)) === 'function' && opts !== undefined) {
return require(path.resolve(this.base, module))(opts)
} else {
return require(path.resolve(this.base, module))
}
process.exit()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment