try.js 564 B

123456789101112131415
  1. 'use strict';
  2. require('../../modules/es.object.to-string');
  3. require('../../modules/es.promise');
  4. require('../../modules/es.promise.try');
  5. var apply = require('../../internals/function-apply');
  6. var isCallable = require('../../internals/is-callable');
  7. var path = require('../../internals/path');
  8. var Promise = path.Promise;
  9. var $try = Promise['try'];
  10. // eslint-disable-next-line no-unused-vars -- required for arity
  11. module.exports = ({ 'try': function (callbackfn /* , ...args */) {
  12. return apply($try, isCallable(this) ? this : Promise, arguments);
  13. } })['try'];