Bruno Jouhier (2013-08-05T07:13:49.000Z)
domenic at domenicdenicola.com (2013-08-12T05:25:03.465Z)
>From a dev standpoint what we need is a clean API to discriminate between types. Sometimes we want to discriminate between objects (mutable) and values (immutable), sometimes between functions and non functions, sometimes between numbers, strings and others, etc. And we don't want to have to write an extra test to exclude null from objects. As we cannot break the existing typeof and its little warts, could we introduce a new call, something like Object.typeInfo(x), that would return a little hash like: ```js { type: "int64", immutable: true, number: true, ... } { type: "string", immutable: true, number: false, ... } { type: "array", immutable: false, number, false, ... } ``` The idea it to have boolean flags like immutable/number/... to categorize types. This way we can discriminate by testing a flag instead of having to test complex combinations of typeof, Array.isArray, etc.