Improve Node's Base.isPlainObject() to rule out arrays.

This commit is contained in:
Jürg Lehni 2013-05-09 01:56:47 -07:00
parent e9fb78aa08
commit e2f4eb5a56

View file

@ -100,7 +100,7 @@ options.version = parseFloat(json.version.replace(/(.)(\d)$/, '$2'));
// current one.
var Base = context.Base;
Base.isPlainObject = function(obj) {
return Object(obj) === obj && (!(obj instanceof Base)
return Object(obj) === obj && !Array.isArray(obj) && (!(obj instanceof Base)
|| Object.getPrototypeOf(obj) === Base.prototype);
};