srijs/rusha — pull request #9 by michaelrhodes (2013-10-23 22:54:50+00:00)
Title: Changed Buffer type check to help browserify

First of all, thanks for the great work on this module. :)

I've discovered that when you run browserify on a module that requires Rusha, the build output contains a [browser shim](https://github.com/substack/node-browserify#compatibility) for node's Buffer object (which is pretty huge). This happens because [insert-module-globals](https://github.com/substack/insert-module-globals/blob/master/index.js) is quite naive and doesn't consider the context in which global names are used (in this case, a simple type check). So even though the problem lies elsewhere, it turns out that by switching to a RegExp + constructor type check, you not only get browserify to play nice, but you also get [a little performance boost](http://jsperf.com/constructor-vs-typeof/2) (for the most part). This makes me think the patch could still be worthwhile, but do let me know. :)