inherits.js 661 B

123456789101112131415161718192021
  1. var setPrototypeOf = require("./setPrototypeOf.js");
  2. function _inherits(subClass, superClass) {
  3. if (typeof superClass !== "function" && superClass !== null) {
  4. throw new TypeError("Super expression must either be null or a function");
  5. }
  6. Object.defineProperty(subClass, "prototype", {
  7. value: Object.create(superClass && superClass.prototype, {
  8. constructor: {
  9. value: subClass,
  10. writable: true,
  11. configurable: true
  12. }
  13. }),
  14. writable: false
  15. });
  16. if (superClass) setPrototypeOf(subClass, superClass);
  17. }
  18. module.exports = _inherits, module.exports.__esModule = true, module.exports["default"] = module.exports;