跳至主要內容

Function.{ isCallable, isConstructor }

小于 1 分钟featurees-proposal

Function.{ isCallable, isConstructor }open in new window

模块

类型

interface FunctionConstructor {
  isCallable(value: any): boolean;
  isConstructor(value: any): boolean;
}

入口点

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

示例

示例open in new window:

Function.isCallable(null); // => false
Function.isCallable({}); // => false
Function.isCallable(function () {}); // => true
Function.isCallable(() => {}); // => true
Function.isCallable(class {}); // => false

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