type/isPlainObject.jsjavascript
/**
* 判断值是否为普通对象(Object 原型或 null 原型)。
* @function isPlainObject
* @memberof module:type
* @param {*} value 待判断的值
* @returns {boolean} 是否为普通对象
*/
function isPlainObject(value) {
if (Object.prototype.toString.call(value) !== '[object Object]') return false
const prototype = Object.getPrototypeOf(value)
return prototype === null || prototype === Object.prototype
}
export default isPlainObject