Looking at the ES5 compatibility table, several browsers provide everything often used (i. e. not Object.freeze() and friends) except Function.prototype.bind
. So I just inline that. Browsers that don't provide other functions also don't include Object.getOwnPropertyNames, so I used it as my test for including the entire shim.
Note that I haven't tested it yet, and it doesn't work for the six Object functions next to each other in the Safari 5 part of the compatibility chart (Safari 5 is deemed good enough).
Update: I added JSON for IE <= 7. JSON is used in a good number of node.js modules.
I was thinking about this within the context of browserify. I realized that JSON.parse is a biggie too, and should be tested for separately, in order to hopefully support a lot of node modules that don't depend on modules that won't run in the browser.
I'm editing this to add json2.