1
|
'use strict';
|
2
|
|
3
|
var GetIntrinsic = require('../GetIntrinsic');
|
4
|
|
5
|
var $TypeError = GetIntrinsic('%TypeError%');
|
6
|
|
7
|
var $arraySlice = require('../helpers/callBound')('Array.prototype.slice');
|
8
|
|
9
|
var Call = require('./Call');
|
10
|
var GetV = require('./GetV');
|
11
|
var IsPropertyKey = require('./IsPropertyKey');
|
12
|
|
13
|
// https://ecma-international.org/ecma-262/6.0/#sec-invoke
|
14
|
|
15
|
module.exports = function Invoke(O, P) {
|
16
|
if (!IsPropertyKey(P)) {
|
17
|
throw new $TypeError('P must be a Property Key');
|
18
|
}
|
19
|
var argumentsList = $arraySlice(arguments, 2);
|
20
|
var func = GetV(O, P);
|
21
|
return Call(func, O, argumentsList);
|
22
|
};
|