function isPlainObject(o) {
return Object(o) === o && Object.getPrototypeOf(o) === Object.prototype;
}
However, you can't test wether o was declared as a literal or instantiated somehow else - you can just test whether it's a plain object without any constructor than Object.