How do you check if a JavaScript object is directly an `{}` instance, not a subclass?
<p>I have spent 10 or 20 minutes here and there probably a dozen times in the past year and never found a bulletproof answer to this question.</p>

<p>How do you check if a JavaScript object is an instance of <code>Object</code>, not a subclass?</p>

<p>One use case for this is to check if <code>arguments[0]</code> is an "options" hash vs. a "model" (MVC), both of which extend the native <code>Object</code>, but which should be treated differently.</p>

<p>I have tried these:</p>

<pre><code>// some helper to get constructor name
function klassName(fn) {
  if (fn.__name__) {
    return fn.__name__;
  }
  if (fn.name) {
    return fn.name;
  }
  return fn.toString().match(/\W*function\s+([\w\$]+)\(/));
};

var Model = function() {};

m = new Model;
o = {};

Object(o) === o; // true
Object(m) === m; // true, thought it might be false

klassName(o.constructor); // Object
klassName(m.constructor); // Model
</code></pre>

<p>That <code>klassName(m.constructor)</code> doesn't work in some cases (can't remember exactly, but maybe a regex.constructor, something like that).  Maybe it does, don't know for sure.</p>

<p>Is there a bulletproof way to tell if something is an <code>{}</code> object?</p>
