documentcloud/underscore — Issue #421: Invert `_.isObject` as `_.isPrimitive`
Author: kitcambridge
Created: 2011-12-29 19:07:13+00:00
State: open

@tbranyen's [tweet](http://twitter.com/tbranyen/status/152460874467115008) suggests that `_.isObject` should return `false` for functions—not an unreasonable assumption, as the method name implies that it will only return `true` if its **argument has an internal `[[Class]]` name of `Object`**. Instead, `isObject`'s purpose is to **distinguish between objects and primitives**—something of an equivocation on the word "object" that can lead to confusion.

Since `isObject` actually differentiates between objects and primitives, I propose inverting it as `isPrimitive`:

_.isPrimitive = function (obj) {
return obj !== Object(obj);
};