Last change
on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
693 bytes
|
Line | |
---|
1 | var isObject = require('../internals/is-object');
|
---|
2 | var setPrototypeOf = require('../internals/object-set-prototype-of');
|
---|
3 |
|
---|
4 | // makes subclassing work correct for wrapped built-ins
|
---|
5 | module.exports = function ($this, dummy, Wrapper) {
|
---|
6 | var NewTarget, NewTargetPrototype;
|
---|
7 | if (
|
---|
8 | // it can work only with native `setPrototypeOf`
|
---|
9 | setPrototypeOf &&
|
---|
10 | // we haven't completely correct pre-ES6 way for getting `new.target`, so use this
|
---|
11 | typeof (NewTarget = dummy.constructor) == 'function' &&
|
---|
12 | NewTarget !== Wrapper &&
|
---|
13 | isObject(NewTargetPrototype = NewTarget.prototype) &&
|
---|
14 | NewTargetPrototype !== Wrapper.prototype
|
---|
15 | ) setPrototypeOf($this, NewTargetPrototype);
|
---|
16 | return $this;
|
---|
17 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.