{"issue":{"milestone":null,"title":"Invert `_.isObject` as `_.isPrimitive`","created_at":"2011-12-29T19:07:13Z","user":{"login":"kitcambridge","id":243830,"url":"https://api.github.com/users/kitcambridge","avatar_url":"https://secure.gravatar.com/avatar/bb3a685a3b48e5332aeb4cc0a01380c5?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"bb3a685a3b48e5332aeb4cc0a01380c5"},"updated_at":"2011-12-30T14:10:11Z","state":"open","labels":[],"id":2681791,"pull_request":{"patch_url":null,"html_url":null,"diff_url":null},"closed_at":null,"html_url":"https://github.com/documentcloud/underscore/issues/421","body":"@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.\r\n\r\nSince `isObject` actually differentiates between objects and primitives, I propose inverting it as `isPrimitive`:\r\n\r\n    _.isPrimitive = function (obj) {\r\n      return obj !== Object(obj);\r\n    };","number":421,"url":"https://api.github.com/repos/documentcloud/underscore/issues/421","comments":2,"assignee":null},"comment":{"created_at":"2011-12-30T14:10:11Z","user":{"login":"jashkenas","id":4732,"url":"https://api.github.com/users/jashkenas","avatar_url":"https://secure.gravatar.com/avatar/32652ed5b8fbd2ecdb1c78e9ac567b4b?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"32652ed5b8fbd2ecdb1c78e9ac567b4b"},"updated_at":"2011-12-30T14:10:11Z","id":3313399,"body":"This would have been *great* to do in the first place ... but I'm not sure if I see a viable path for breaking compatibility just to give you the same (but inverted) API, by a different name. I'd rather not have both names, or break back-compat ... so I think we should just leave it be. ","url":"https://api.github.com/repos/documentcloud/underscore/issues/comments/3313399"},"action":"created"}