jrburke/requirejs — pull request #337 by masklinn (2012-06-21 12:40:51+00:00)
Title: Object.prototype.toString for type-testing rather than instanceof?

That's a pattern I see regularly, but i don't grasp why it'd be done: codebases (including requirejs) tend to use the `Object.prototype.toString(o) === '[object SomeType]'` pattern when testing types rather than use the native `instanceof`, even when testing for actual object types (e.g. `Function` or `Array`), even though `instanceof` is [universally faster, even when the thing being tested has to be wrapped](http://jsperf.com/bound-object-prototype-tostring-vs-unbound/2) and expresses intent much more clearly.

The only reason I'd see is the fear of developers creating subclasses of the types being tested and that being incorrect/undesirable for some reason. Am I missing something?