Function.{ isCallable, isConstructor }

Specification: tc39-reflect-isconstructor-iscallable

Modules

esnext.function.is-callable, esnext.function.is-constructor

class Function {
  static isCallable(value: any): boolean;
  static isConstructor(value: any): boolean;
}

CommonJS entry points

core-js/proposals/function-is-callable-is-constructor
core-js(-pure)/full/function/is-callable
core-js(-pure)/full/function/is-constructor

Examples

/* eslint-disable prefer-arrow-callback -- example */
Function.isCallable(null);                        // => false
Function.isCallable({});                          // => false
Function.isCallable(function () { /* empty */ }); // => true
Function.isCallable(() => { /* empty */ });       // => true
Function.isCallable(class { /* empty */ });       // => false

Function.isConstructor(null);                        // => false
Function.isConstructor({});                          // => false
Function.isConstructor(function () { /* empty */ }); // => true
Function.isConstructor(() => { /* empty */ });       // => false
Function.isConstructor(class { /* empty */ });       // => true