Created
March 21, 2013 21:31
-
-
Save pyykkis/5216983 to your computer and use it in GitHub Desktop.
Browserify transformer to bind 'this' to module.exports.
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
through = require('through'); | |
module.exports = function (file) { | |
var tr = through(null, function () { | |
this.queue('}).call(module.exports)'); this.queue(null) }); tr.pause(); | |
tr.queue('(function(){'); process.nextTick(tr.resume.bind(tr)); return tr; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment