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