Last change
on this file since 188ee53 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
908 bytes
|
Line | |
---|
1 | var setPrototypeOf = require("./setPrototypeOf.js");
|
---|
2 |
|
---|
3 | var isNativeReflectConstruct = require("./isNativeReflectConstruct.js");
|
---|
4 |
|
---|
5 | function _construct(Parent, args, Class) {
|
---|
6 | if (isNativeReflectConstruct()) {
|
---|
7 | module.exports = _construct = Reflect.construct;
|
---|
8 | module.exports["default"] = module.exports, module.exports.__esModule = true;
|
---|
9 | } else {
|
---|
10 | module.exports = _construct = function _construct(Parent, args, Class) {
|
---|
11 | var a = [null];
|
---|
12 | a.push.apply(a, args);
|
---|
13 | var Constructor = Function.bind.apply(Parent, a);
|
---|
14 | var instance = new Constructor();
|
---|
15 | if (Class) setPrototypeOf(instance, Class.prototype);
|
---|
16 | return instance;
|
---|
17 | };
|
---|
18 |
|
---|
19 | module.exports["default"] = module.exports, module.exports.__esModule = true;
|
---|
20 | }
|
---|
21 |
|
---|
22 | return _construct.apply(null, arguments);
|
---|
23 | }
|
---|
24 |
|
---|
25 | module.exports = _construct;
|
---|
26 | module.exports["default"] = module.exports, module.exports.__esModule = true; |
---|
Note:
See
TracBrowser
for help on using the repository browser.