MCPcopy
hub / github.com/miragejs/miragejs / extend

Function extend

lib/utils/extend.js:6–29  ·  view source on GitHub ↗
(protoProps, staticProps)

Source from the content-addressed store, hash-verified

4 @hide
5*/
6export default function extend(protoProps, staticProps) {
7 class Child extends this {
8 constructor(...args) {
9 super(...args);
10 // The constructor function for the new subclass is optionally defined by you
11 // in your `extend` definition
12 if (protoProps && has(protoProps, "constructor")) {
13 protoProps.constructor.call(this, ...args);
14 }
15 }
16 }
17
18 // Add static properties to the constructor function, if supplied.
19
20 Object.assign(Child, this, staticProps);
21
22 // Add prototype properties (instance properties) to the subclass,
23 // if supplied.
24 if (protoProps) {
25 Object.assign(Child.prototype, protoProps);
26 }
27
28 return Child;
29}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…