MCPcopy
hub / github.com/phaserjs/phaser / IsPlainObject

Function IsPlainObject

src/utils/object/IsPlainObject.js:21–51  ·  view source on GitHub ↗
(obj)

Source from the content-addressed store, hash-verified

19 * @return {boolean} `true` if the object is plain, otherwise `false`.
20 */
21var IsPlainObject = function (obj)
22{
23 // Not plain objects:
24 // - Any object or value whose internal [[Class]] property is not "[object Object]"
25 // - DOM nodes
26 // - window
27 if (!obj || typeof(obj) !== 'object' || obj.nodeType || obj === obj.window)
28 {
29 return false;
30 }
31
32 // Support: Firefox <20
33 // The try/catch suppresses exceptions thrown when attempting to access
34 // the "constructor" property of certain host objects, ie. |window.location|
35 // https://bugzilla.mozilla.org/show_bug.cgi?id=814622
36 try
37 {
38 if (obj.constructor && !({}).hasOwnProperty.call(obj.constructor.prototype, 'isPrototypeOf'))
39 {
40 return false;
41 }
42 }
43 catch (e)
44 {
45 return false;
46 }
47
48 // If the function hasn't returned already, we're confident that
49 // |obj| is a plain object, created by {} or constructed with new Object
50 return true;
51};
52
53module.exports = IsPlainObject;

Callers 15

ExtendFunction · 0.85
Config.jsFile · 0.85
PhysicsGroup.jsFile · 0.85
TextureManager.jsFile · 0.85
LoaderPlugin.jsFile · 0.85
AtlasJSONFile.jsFile · 0.85
JSONFile.jsFile · 0.85
SVGFile.jsFile · 0.85
HTMLFile.jsFile · 0.85
TextFile.jsFile · 0.85
GLSLFile.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…