检测是否为纯粹的对象「标准普通对象」
const isPlainObject = function isPlainObject(obj) {if (obj == null) return falseif (toString.call(obj) !== '[object Object]') return false// 考虑 Object.create(null) 这种情况let proto = Object.getPrototypeOf(obj)if (!proto) return true// 剩下的就看其 constructor 是不是 Objectlet ctor = proto.hasOwnProperty('constructor') && obj.constructorreturn typeof ctor === 'function' && ctor instanceof ctor && ctor === Object}
