Created
February 3, 2017 18:41
-
-
Save ghaiklor/9abac5a6efb24829312c755c88713519 to your computer and use it in GitHub Desktop.
Module.prototype.load sources
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
// Given a file name, pass it to the proper extension handler. | |
Module.prototype.load = function(filename) { | |
debug('load %j for module %j', filename, this.id); | |
assert(!this.loaded); | |
this.filename = filename; | |
this.paths = Module._nodeModulePaths(path.dirname(filename)); | |
var extension = path.extname(filename) || '.js'; | |
if (!Module._extensions[extension]) extension = '.js'; | |
Module._extensions[extension](this, filename); | |
this.loaded = true; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment