1 |
3a515b92
|
cagy
|
'use strict';
|
2 |
|
|
|
3 |
|
|
var GetIntrinsic = require('../GetIntrinsic');
|
4 |
|
|
|
5 |
|
|
var $TypeError = GetIntrinsic('%TypeError%');
|
6 |
|
|
|
7 |
|
|
var inspect = require('object-inspect');
|
8 |
|
|
|
9 |
|
|
var IsCallable = require('./IsCallable');
|
10 |
|
|
|
11 |
|
|
// https://www.ecma-international.org/ecma-262/6.0/#sec-call
|
12 |
|
|
|
13 |
|
|
module.exports = function Call(F, V) {
|
14 |
|
|
var args = arguments.length > 2 ? arguments[2] : [];
|
15 |
|
|
if (!IsCallable(F)) {
|
16 |
|
|
throw new $TypeError(inspect(F) + ' is not a function');
|
17 |
|
|
}
|
18 |
|
|
return F.apply(V, args);
|
19 |
|
|
};
|