es.reflect.apply.js 761 B

12345678910111213141516171819
  1. var $ = require('../internals/export');
  2. var functionApply = require('../internals/function-apply');
  3. var aCallable = require('../internals/a-callable');
  4. var anObject = require('../internals/an-object');
  5. var fails = require('../internals/fails');
  6. // MS Edge argumentsList argument is optional
  7. var OPTIONAL_ARGUMENTS_LIST = !fails(function () {
  8. // eslint-disable-next-line es/no-reflect -- required for testing
  9. Reflect.apply(function () { /* empty */ });
  10. });
  11. // `Reflect.apply` method
  12. // https://tc39.es/ecma262/#sec-reflect.apply
  13. $({ target: 'Reflect', stat: true, forced: OPTIONAL_ARGUMENTS_LIST }, {
  14. apply: function apply(target, thisArgument, argumentsList) {
  15. return functionApply(aCallable(target), thisArgument, anObject(argumentsList));
  16. }
  17. });