笼统校验是否为对象

    1. const isObject = function isObject(obj) {
    2. return obj !== null && /^(object|function)$/.test(typeof obj)
    3. }

    检测是否为函数

    1. const isFunction = function isFunction(obj) {
    2. return typeof obj === 'function'
    3. }

    检测是否为window

    1. const isWindow = function isWindow(obj) {
    2. return obj != null && obj === obj.window
    3. }