jasnell / proposal-istypes

TC-39 Proposal for additional is{Type} APIs
201 stars 7 forks source link

one-arg is: remove, or harden? #24

Closed ljharb closed 7 years ago

ljharb commented 7 years ago

The one-arg Builtin.is is a bit weird.

If it's trying to answer the question "is this built-in", then it should probably return false if the Symbol.builtin method is !== the original one.

However, I'm also not sure of the utility of the one-arg form in the first place.

jasnell commented 7 years ago

I generally agree that it's a bit weird, and to be honest, I think I'd be fine with dropping it. For Builtin.is(Date, undefined), we would just return false.

ljharb commented 7 years ago

That sounds great to me.

Alternatively, if we do want a single-arg function, it should probably be a separate one, instead of overloading is.

jasnell commented 7 years ago

For now, let's just dump the one-arg version entirely. We can add it back later if necessary. I'll update the PR a bit later today.

ljharb commented 7 years ago

Sounds great. I can always replicate it by grabbing a Symbol.builtin method and calling it directly, and testing for an exception/undefined.

jasnell commented 7 years ago

one arg has been removed