I normally name it `isReferenceType` or similar, but was just reusing
the name originally used here. For the purposes of this, my
`isReferenceType` is equivalent to the `value === new function () {
return value }` check, while still avoiding diving into builtins. I
was just focused on a correct equivalent.

I know `typeof` can be rather loose at times with old IE (and heck, it
once was in other engines, too - consider the old V8 bug `typeof /foo/
=== "function"`).

My question was whether it was feasible *now*, and specifically with
respect to non-primitives (where `isReferenceType(value) === false`).
So far, the only problem explained here was with a fairly unique use
case I offered an alternative of, and I'm just trying to explore to
see if the breaking nature has changed enough it's worthy to consider
lifting the restriction.

-----

Isiah Meadows
[email protected]

Looking for web consulting? Or a new website?
Send me an email and we can get started.
www.isiahmeadows.com


On Fri, Apr 20, 2018 at 9:46 AM, T.J. Crowder
<[email protected]> wrote:
> On Fri, Apr 20, 2018 at 2:23 PM, Oriol _
> <[email protected]> wrote:
>> No, `typeof` is not reliable, because it's implementation-defined
>> for non-standard non-callable exotic objects.
>>
>> For example, old IE used to return `"unknown"` in various cases.
>
> Also `"object"` for host-provided functions (such as
> `document.createElement`); IE8 still does that. (Thankfully IE11 doesn't.)
> (I suppose that would have passed Isiah's `isObject` test anyway, but the
> point is that `typeof` is, sadly, a weak reed...)
>
> -- T.J. Crowder
>
> _______________________________________________
> es-discuss mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/es-discuss
>
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to