MCPcopy
hub / github.com/exceljs/exceljs / inherits

Function inherits

lib/utils/utils.js:4–34  ·  view source on GitHub ↗
(cls, superCtor, statics, prototype)

Source from the content-addressed store, hash-verified

2
3// useful stuff
4const inherits = function(cls, superCtor, statics, prototype) {
5 // eslint-disable-next-line no-underscore-dangle
6 cls.super_ = superCtor;
7
8 if (!prototype) {
9 prototype = statics;
10 statics = null;
11 }
12
13 if (statics) {
14 Object.keys(statics).forEach(i => {
15 Object.defineProperty(cls, i, Object.getOwnPropertyDescriptor(statics, i));
16 });
17 }
18
19 const properties = {
20 constructor: {
21 value: cls,
22 enumerable: false,
23 writable: false,
24 configurable: true,
25 },
26 };
27 if (prototype) {
28 Object.keys(prototype).forEach(i => {
29 properties[i] = Object.getOwnPropertyDescriptor(prototype, i);
30 });
31 }
32
33 cls.prototype = Object.create(superCtor.prototype, properties);
34};
35
36// eslint-disable-next-line no-control-regex
37const xmlDecodeRegex = /[<>&'"\x7F\x00-\x08\x0B-\x0C\x0E-\x1F]/;

Callers

nothing calls this directly

Calls 1

forEachMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…