react / wstein / node_modules / jest-cli / node_modules / istanbul / node_modules / js-yaml / node_modules / argparse / node_modules / lodash / lang / isPlainObject.js
80742 viewsvar getNative = require('../internal/getNative'),1shimIsPlainObject = require('../internal/shimIsPlainObject');23/** `Object#toString` result references. */4var objectTag = '[object Object]';56/** Used for native method references. */7var objectProto = Object.prototype;89/**10* Used to resolve the [`toStringTag`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring)11* of values.12*/13var objToString = objectProto.toString;1415/** Native method references. */16var getPrototypeOf = getNative(Object, 'getPrototypeOf');1718/**19* Checks if `value` is a plain object, that is, an object created by the20* `Object` constructor or one with a `[[Prototype]]` of `null`.21*22* **Note:** This method assumes objects created by the `Object` constructor23* have no inherited enumerable properties.24*25* @static26* @memberOf _27* @category Lang28* @param {*} value The value to check.29* @returns {boolean} Returns `true` if `value` is a plain object, else `false`.30* @example31*32* function Foo() {33* this.a = 1;34* }35*36* _.isPlainObject(new Foo);37* // => false38*39* _.isPlainObject([1, 2, 3]);40* // => false41*42* _.isPlainObject({ 'x': 0, 'y': 0 });43* // => true44*45* _.isPlainObject(Object.create(null));46* // => true47*/48var isPlainObject = !getPrototypeOf ? shimIsPlainObject : function(value) {49if (!(value && objToString.call(value) == objectTag)) {50return false;51}52var valueOf = getNative(value, 'valueOf'),53objProto = valueOf && (objProto = getPrototypeOf(valueOf)) && getPrototypeOf(objProto);5455return objProto56? (value == objProto || getPrototypeOf(value) == objProto)57: shimIsPlainObject(value);58};5960module.exports = isPlainObject;616263