is-what icon indicating copy to clipboard operation
is-what copied to clipboard

Add isCallable() and isConstructable()

Open jcbhmr opened this issue 2 years ago • 1 comments

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
}

jcbhmr avatar Jun 02 '23 23:06 jcbhmr

Seems good to me! PR welcome

mesqueeb avatar Jun 03 '23 04:06 mesqueeb