inherits.js 733 B

12345678910111213141516171819
  1. import _Object$create from "@babel/runtime-corejs3/core-js/object/create";
  2. import _Object$defineProperty from "@babel/runtime-corejs3/core-js/object/define-property";
  3. import setPrototypeOf from "./setPrototypeOf.js";
  4. export default function _inherits(subClass, superClass) {
  5. if (typeof superClass !== "function" && superClass !== null) {
  6. throw new TypeError("Super expression must either be null or a function");
  7. }
  8. subClass.prototype = _Object$create(superClass && superClass.prototype, {
  9. constructor: {
  10. value: subClass,
  11. writable: true,
  12. configurable: true
  13. }
  14. });
  15. _Object$defineProperty(subClass, "prototype", {
  16. writable: false
  17. });
  18. if (superClass) setPrototypeOf(subClass, superClass);
  19. }