is-what
is-what copied to clipboard
Add isCallable() and isConstructable()
https://github.com/caitp/TC39-Proposals/blob/trunk/tc39-reflect-isconstructor-iscallable.md
☝ Basically that.
Use case:
if (isConstructable(thing)) {
return new thing()
} else if (isCallable(thing)) {
return thing()
} else {
return thing
}
Seems good to me! PR welcome