Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
checkNatives
function isNativeFunction(fn) {
return typeof fn === 'function' && fn.toString && !fn.hasOwnProperty('toString') &&
/\[native code\]/.test(String(fn))
}
function checkNatives(fns) {
var results = []
for (var i = 0; i < fns.length; i++) {
results[i] = {
fn: fns[i],
native: isNativeFunction(fns[i])
}
}
return results
}
console.info(checkNatives([setTimeout, XMLHttpRequest]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment