Created
January 1, 2020 04:10
-
-
Save paxperscientiam/d0dba890796573dfcafddf0f738280c5 to your computer and use it in GitHub Desktop.
req
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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