Skip to content

Instantly share code, notes, and snippets.

@heapwolf
Created November 29, 2010 04:30
Show Gist options
  • Select an option

  • Save heapwolf/719583 to your computer and use it in GitHub Desktop.

Select an option

Save heapwolf/719583 to your computer and use it in GitHub Desktop.
identify ES5 functions that are not implemented in a browser (returns an object literal of arrays that contain the names of the missing functions)
var issues = (function() {
var o = {
"Array.prototype": "forEach map reduce reduceRight filter every some indexOf lastIndexOf",
"Array": "isArray",
"Object": "keys preventExtensions isExtensible getOwnPropertyDescriptor defineProperty getOwnPropertyNames create seal isSealed freeze isFrozen"
};
for(var l in o) {
o[l] = o[l].split(" ");
for(var f=0; f<o[l].length; f++) {
var k = l.split(".");
if(!!(k[1] ? window[k[0]][k[1]] : window[k[0]])[o[l][f]]) {
o[l].splice(f, 1); --f;
}
}
}
return o;
})();
@heapwolf
Copy link
Author

this is not tested with IE. Not sure exactly how dependable it is, i needed it for a pretty narrow edge case. please feel free to mod!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment