1 | 'use strict';
|
2 | var $ = require('../internals/export');
|
3 | var IS_PURE = require('../internals/is-pure');
|
4 | var FORCED_PROMISE_CONSTRUCTOR = require('../internals/promise-constructor-detection').CONSTRUCTOR;
|
5 | var NativePromiseConstructor = require('../internals/promise-native-constructor');
|
6 | var getBuiltIn = require('../internals/get-built-in');
|
7 | var isCallable = require('../internals/is-callable');
|
8 | var defineBuiltIn = require('../internals/define-built-in');
|
9 |
|
10 | var NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype;
|
11 |
|
12 |
|
13 |
|
14 | $({ target: 'Promise', proto: true, forced: FORCED_PROMISE_CONSTRUCTOR, real: true }, {
|
15 | 'catch': function (onRejected) {
|
16 | return this.then(undefined, onRejected);
|
17 | }
|
18 | });
|
19 |
|
20 |
|
21 | if (!IS_PURE && isCallable(NativePromiseConstructor)) {
|
22 | var method = getBuiltIn('Promise').prototype['catch'];
|
23 | if (NativePromisePrototype['catch'] !== method) {
|
24 | defineBuiltIn(NativePromisePrototype, 'catch', method, { unsafe: true });
|
25 | }
|
26 | }
|