1 | var $ = require('../internals/export');
|
2 | var getBuiltIn = require('../internals/get-built-in');
|
3 | var aFunction = require('../internals/a-function');
|
4 | var anObject = require('../internals/an-object');
|
5 | var fails = require('../internals/fails');
|
6 |
|
7 | var nativeApply = getBuiltIn('Reflect', 'apply');
|
8 | var functionApply = Function.apply;
|
9 |
|
10 |
|
11 | var OPTIONAL_ARGUMENTS_LIST = !fails(function () {
|
12 | nativeApply(function () { });
|
13 | });
|
14 |
|
15 |
|
16 |
|
17 | $({ target: 'Reflect', stat: true, forced: OPTIONAL_ARGUMENTS_LIST }, {
|
18 | apply: function apply(target, thisArgument, argumentsList) {
|
19 | aFunction(target);
|
20 | anObject(argumentsList);
|
21 | return nativeApply
|
22 | ? nativeApply(target, thisArgument, argumentsList)
|
23 | : functionApply.call(target, thisArgument, argumentsList);
|
24 | }
|
25 | });
|