simple-squiggle

A restricted subset of Squiggle
Log | Files | Refs | README

inherits.js (565B)


      1 import setPrototypeOf from "./setPrototypeOf.js";
      2 export default 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 
      7   subClass.prototype = Object.create(superClass && superClass.prototype, {
      8     constructor: {
      9       value: subClass,
     10       writable: true,
     11       configurable: true
     12     }
     13   });
     14   Object.defineProperty(subClass, "prototype", {
     15     writable: false
     16   });
     17   if (superClass) setPrototypeOf(subClass, superClass);
     18 }