原生函数调用toString返回function () {\n [native code]\n}MDN
/**
* 检测一个函数是否是原生的,而不是polyfill的
*
* @param func 待检测函数
*/
function isNativeFunction(func: Function): boolean {
return typeof func === 'function' && /native code/.test(func.toString());
}
原生函数调用toString返回function () {\n [native code]\n}MDN
/**
* 检测一个函数是否是原生的,而不是polyfill的
*
* @param func 待检测函数
*/
function isNativeFunction(func: Function): boolean {
return typeof func === 'function' && /native code/.test(func.toString());
}