Node-Red configuration
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

inherit-if-required.js 750B

12345678910111213141516171819
  1. 'use strict';
  2. var isCallable = require('../internals/is-callable');
  3. var isObject = require('../internals/is-object');
  4. var setPrototypeOf = require('../internals/object-set-prototype-of');
  5. // makes subclassing work correct for wrapped built-ins
  6. module.exports = function ($this, dummy, Wrapper) {
  7. var NewTarget, NewTargetPrototype;
  8. if (
  9. // it can work only with native `setPrototypeOf`
  10. setPrototypeOf &&
  11. // we haven't completely correct pre-ES6 way for getting `new.target`, so use this
  12. isCallable(NewTarget = dummy.constructor) &&
  13. NewTarget !== Wrapper &&
  14. isObject(NewTargetPrototype = NewTarget.prototype) &&
  15. NewTargetPrototype !== Wrapper.prototype
  16. ) setPrototypeOf($this, NewTargetPrototype);
  17. return $this;
  18. };