绩效考核手机版
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
597 B

3 years ago
import hasOwnProp from './hasOwnProp';
import getType from './getType';
/**
* @description: 判断指定参数是否是一个纯粹的对象
* @param {object} obj
* @return {boolean}
*/
export default function isPlainObject(obj) {
if (!obj || getType(obj) !== 'object') {
return false;
}
const proto = Object.getPrototypeOf(obj);
if (!proto) {
return true;
}
const ctor = hasOwnProp(proto, 'constructor') && proto.constructor;
const fnToString = Object.hasOwnProperty.toString;
return typeof ctor === 'function' && fnToString.call(ctor) === fnToString.call(Object);
}