On Fri, Apr 27, 2012 at 14:57, Filip Maj <[email protected]> wrote: > Here's the grep output from cordova-js, and I'll provide context for each > little bit below the grep output. Five general cases. All but one > instanceof check against a native type (and that one we can change away > from testing against one of our defined types). >
My vote is typeof for everything but Array and Date, and add some handy-dandy util methods isArray() and isDate() to do the checking with the toString hack(). Alternately, define a replacement for typeof called, say, isType(object, string), and do all the relevant checks/hacks in there. And throw an exception if they pass a string we don't check for :-) -- Patrick Mueller http://muellerware.org
