isCallable
Available since v0.7
Determine if a value is "callable" - a function that is not a class constructor.
import { isCallable } from "@aedart/support/reflections";
isCallable(null); // false
isCallable({}); // false
isCallable([]); // false
isCallable(class {}); // false
isCallable(function() {}); // true
isCallable(() => {}); // true
isCallable(Array); // true
Acknowledgement
The source code of the above shown methods is heavily inspired by Denis Pushkarev's Core-js implementation of the Function.isCallable / Function.isConstructor proposal (License MIT).
See also isClassConstructor()
.