+
+ /** Returns whether the provided value is a constructor. */
+ isConstructor,
+} = (() => {
+ const { apply, construct } = Reflect;
+ return {
+ call: (target, thisArgument, argumentsList) =>
+ apply(target, thisArgument, argumentsList),
+ construct: (target, argumentsList, ...args) =>
+ args.length > 0
+ ? construct(target, argumentsList, args[0])
+ : construct(target, argumentsList),
+ isConstructor: ($) =>
+ completesNormally(() =>
+ // Try constructing a new object with the provided value as its
+ // `new.target`. This will throw if the provided value is not a
+ // constructor.
+ construct(function () {}, [], $)
+ ),
+ };
+})();