1if (typeof Promise !== 'function') { 2 throw new TypeError('A global Promise is required'); 3} 4 5if (typeof Promise.prototype.finally !== 'function') { 6 var speciesConstructor = function (O, defaultConstructor) { 7 if (!O || (typeof O !== 'object' && typeof O !== 'function')) { 8 throw new TypeError('Assertion failed: Type(O) is not Object'); 9 } 10 var C = O.constructor; 11 if (typeof C === 'undefined') { 12 return defaultConstructor; 13 } 14 if (!C || (typeof C !== 'object' && typeof C !== 'function')) { 15 throw new TypeError('O.constructor is not an Object'); 16 } 17 var S = typeof Symbol === 'function' && typeof Symbol.species === 'symbol' ? C[Symbol.species] : undefined; 18 if (S == null) { 19 return defaultConstructor; 20 } 21 if (typeof S === 'function' && S.prototype) { 22 return S; 23 } 24 throw new TypeError('no constructor found'); 25 }; 26 27 var shim = { 28 finally(onFinally) { 29 var promise = this; 30 if (typeof promise !== 'object' || promise === null) { 31 throw new TypeError('"this" value is not an Object'); 32 } 33 var C = speciesConstructor(promise, Promise); // throws if SpeciesConstructor throws 34 if (typeof onFinally !== 'function') { 35 return Promise.prototype.then.call(promise, onFinally, onFinally); 36 } 37 return Promise.prototype.then.call( 38 promise, 39 x => new C(resolve => resolve(onFinally())).then(() => x), 40 e => new C(resolve => resolve(onFinally())).then(() => { throw e; }) 41 ); 42 } 43 }; 44 Object.defineProperty(Promise.prototype, 'finally', { configurable: true, writable: true, value: shim.finally }); 45}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.