-
-
Save javruben/668949 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
if (!module.constructor.prototype.declare) { | |
module.constructor.prototype.declare = function(deps, factory) { | |
if (!factory) | |
factory = deps; | |
var _self = this; | |
var req = function(id) { | |
if (id.indexOf("./") == 0) | |
id = _self.filename.match(/(.*\/)/)[1] + id.slice(2) | |
return require(id); | |
} | |
factory(req, this.exports, this); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment