Created
July 6, 2015 17:06
-
-
Save tdantas/aa31c677722ad837661a to your computer and use it in GitHub Desktop.
node module closure
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
$ node | |
> var m = require('module'); | |
undefined | |
> require.toString() | |
'function require(path) {\n return self.require(path);\n }' | |
> module.require.toString() | |
'function (path) {\n assert(path, \'missing path\');\n assert(util.isString(path), \'path must be a string\');\n return Module._load(path, this);\n}' | |
> m.wrapper | |
[ '(function (exports, require, module, __filename, __dirname) { ', | |
'\n});' ] | |
> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment