Last change
on this file since 59329aa was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
695 bytes
|
Rev | Line | |
---|
[6a3a178] | 1 | "use strict";
|
---|
| 2 |
|
---|
| 3 | Object.defineProperty(exports, "__esModule", {
|
---|
| 4 | value: true
|
---|
| 5 | });
|
---|
| 6 | exports.default = inherits;
|
---|
| 7 |
|
---|
| 8 | var _constants = require("../constants");
|
---|
| 9 |
|
---|
| 10 | var _inheritsComments = require("../comments/inheritsComments");
|
---|
| 11 |
|
---|
| 12 | function inherits(child, parent) {
|
---|
| 13 | if (!child || !parent) return child;
|
---|
| 14 |
|
---|
| 15 | for (const key of _constants.INHERIT_KEYS.optional) {
|
---|
| 16 | if (child[key] == null) {
|
---|
| 17 | child[key] = parent[key];
|
---|
| 18 | }
|
---|
| 19 | }
|
---|
| 20 |
|
---|
| 21 | for (const key of Object.keys(parent)) {
|
---|
| 22 | if (key[0] === "_" && key !== "__clone") child[key] = parent[key];
|
---|
| 23 | }
|
---|
| 24 |
|
---|
| 25 | for (const key of _constants.INHERIT_KEYS.force) {
|
---|
| 26 | child[key] = parent[key];
|
---|
| 27 | }
|
---|
| 28 |
|
---|
| 29 | (0, _inheritsComments.default)(child, parent);
|
---|
| 30 | return child;
|
---|
| 31 | } |
---|
Note:
See
TracBrowser
for help on using the repository browser.