You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Invoke.js 591B

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