- return applyProperties($, {
- length: +length + lengthDelta,
- name,
- prototype,
- });
+ if (hasOwnProperty($, "prototype") && "prototype" in base) {
+ // The provided function has a `.prototype´ property, and one
+ // was provided in the base function as well.
+ try {
+ // If this does not throw, the provided function is a
+ // constructor. Its `.prototype´ property is set alongside
+ // the others.
+ reflectConstruct(function () {}, [], $);
+ overrides.prototype = base.prototype;
+ } catch {
+ // The provided function is not a constructor.
+ /* do nothing */
+ }
+ } else {
+ // The provided function does not have a `.prototype´ property,
+ // or the base function did not have one.
+ /* do nothing */
+ }
+ return applyProperties($, overrides);