Updating NPM dependencies
This commit is contained in:
72
node_modules/jest-jasmine2/build/PCancelable.js
generated
vendored
72
node_modules/jest-jasmine2/build/PCancelable.js
generated
vendored
@@ -1,15 +1,33 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol;
|
||||
var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol;
|
||||
var Promise = global[Symbol.for('jest-native-promise')] || global.Promise;
|
||||
|
||||
function _defineProperty(obj, key, value) {
|
||||
if (key in obj) {
|
||||
Object.defineProperty(obj, key, {
|
||||
value: value,
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true
|
||||
});
|
||||
} else {
|
||||
obj[key] = value;
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol;
|
||||
var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol;
|
||||
var Promise = global[Symbol.for('jest-native-promise')] || global.Promise;
|
||||
|
||||
class CancelError extends Error {
|
||||
constructor() {
|
||||
super('Promise was canceled');
|
||||
@@ -17,20 +35,20 @@ class CancelError extends Error {
|
||||
}
|
||||
}
|
||||
|
||||
class PCancelable {
|
||||
static fn(fn) {
|
||||
return function() {
|
||||
const args = [].slice.apply(arguments);
|
||||
return new PCancelable((onCancel, resolve, reject) => {
|
||||
args.unshift(onCancel);
|
||||
fn.apply(null, args).then(resolve, reject);
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
class PCancelable extends Promise {
|
||||
constructor(executor) {
|
||||
this._pending = true;
|
||||
this._canceled = false;
|
||||
super(resolve => resolve());
|
||||
|
||||
_defineProperty(this, '_pending', true);
|
||||
|
||||
_defineProperty(this, '_canceled', false);
|
||||
|
||||
_defineProperty(this, '_promise', void 0);
|
||||
|
||||
_defineProperty(this, '_cancel', void 0);
|
||||
|
||||
_defineProperty(this, '_reject', () => {});
|
||||
|
||||
this._promise = new Promise((resolve, reject) => {
|
||||
this._reject = reject;
|
||||
return executor(
|
||||
@@ -49,12 +67,12 @@ class PCancelable {
|
||||
});
|
||||
}
|
||||
|
||||
then() {
|
||||
return this._promise.then.apply(this._promise, arguments);
|
||||
then(onFulfilled, onRejected) {
|
||||
return this._promise.then(onFulfilled, onRejected);
|
||||
}
|
||||
|
||||
catch() {
|
||||
return this._promise.catch.apply(this._promise, arguments);
|
||||
catch(onRejected) {
|
||||
return this._promise.catch(onRejected);
|
||||
}
|
||||
|
||||
cancel() {
|
||||
@@ -74,12 +92,6 @@ class PCancelable {
|
||||
|
||||
this._reject(new CancelError());
|
||||
}
|
||||
|
||||
get canceled() {
|
||||
return this._canceled;
|
||||
}
|
||||
}
|
||||
|
||||
Object.setPrototypeOf(PCancelable.prototype, Promise.prototype);
|
||||
module.exports = PCancelable;
|
||||
module.exports.CancelError = CancelError;
|
||||
exports.default = PCancelable;
|
||||
|
||||
Reference in New Issue
Block a user