isPlainObject
Test if a value is an object created with {} or new Object().
isPlainObject(obj)
Attempts to determine if an object is a plain object like those you would create using the curly braces syntax: {}. The following are not plain objects:
- Objects with prototypes (created using the
newkeyword). - Booleans.
- Numbers.
- NaN.
var isPlainObject = require("can-reflect").isPlainObject;
// Created with {}
console.log(isPlainObject({})); // -> true
// new Object
console.log(isPlainObject(new Object())); // -> true
// Custom object
var Ctr = function(){};
var obj = new Ctr();
console.log(isPlainObject(obj)); // -> false
Parameters
- obj
{Object}:the object to test.
Returns
{Boolean}: