function judgeTypeFnCreator (type) { const toString = Object.prototype.toString return function isType (o) { return toString.call(o) === `[object ${type}]` } }     const isFunc = judgeTypeFnCreator('Function') const isUndef = judgeTypeFnCreator('Undefined') const isArray = judgeTypeFnCreator('Array') const isString = judgeTypeFnCreator('String') const isObject = judgeTypeFnCreator('Object') const isNumber = judgeTypeFnCreator('Number')     function deepAssign(to, from) { for (let key in from) { if (!to[key] || typeof to[key] !== 'object') { to[key] = from[key] } else { deepAssign(to[key], from[key]) } } }
扫码关注我们
微信号:SRE实战
拒绝背锅 运筹帷幄