I'm writing some charting components using D3. Some of these components are deliberately generic, so they can be re-used in various scenarios.

In one function, I receive a scale object as an argument. I want to take slightly different actions depending on whether this is a linear scale, a time scale, or an ordinal scale.

However I cannot easily see how to detect which type of scale I've got.

* `instanceof` does not work - these objects aren't create with `new` and don't have a prototype set. They are Function objects with additional attributes added to them.
* `typeof` returns 'object' in all cases (naturally)
* at least in the case of ordinal scales, there are some additional attributes that I can use for detection, so I can use:

```
if (scale.rangeBound) {
    // do something specific to ordinal scales
}

```

but that does not seem to be the case for different types of quantative scales, which seem to have identical sets of attributes.
* I can add some attribute to each scale I create indicating it's type, but I would prefer not to as it reduces the generality of the functions I am creating (they would require scales passed to them which had these attributes added). Also I would risk clashing with some attribute added by a future version of D3.

In fact this question could be extended to many of the objects within D3. Is there any way to tell them apart?