判断一个函数是否为native code

    1. function isNative (Ctor) {
    2. return typeof Ctor === 'function' && /[native code]/.test(Ctor.toString())
    3. }
    1. typeof Promise !== 'undefined' && isNative(Promise)