promise-toolbox
Advanced tools
Comparing version 0.18.1 to 0.19.0
"use strict"; | ||
var Disposable = require("./Disposable"); | ||
var isDisposable = require("./_isDisposable"); | ||
var pTry = require("./try"); | ||
var resolve = require("./_resolve"); | ||
@@ -13,11 +11,14 @@ module.exports = function () { | ||
this._disposers = []; | ||
this._disposables = []; | ||
var dispose = function dispose() { | ||
var disposer = _this._disposers.pop(); | ||
var disposable = _this._disposables.pop(); | ||
return disposer !== undefined ? pTry(disposer).then(dispose) : Promise.resolve(); | ||
return disposable !== undefined ? resolve(disposable.dispose()).then(dispose) : Promise.resolve(); | ||
}; | ||
return new Disposable(this, dispose); | ||
return { | ||
dispose, | ||
value: this | ||
}; | ||
} | ||
@@ -32,3 +33,3 @@ | ||
this._disposers.push(disposable.dispose); | ||
this._disposables.push(disposable); | ||
@@ -35,0 +36,0 @@ return disposable.value; |
@@ -12,20 +12,2 @@ "use strict"; | ||
exports.applyThen = function (fn, args, onSuccess, onFailure) { | ||
var returnValue; | ||
try { | ||
returnValue = fn.apply(undefined, args); | ||
if (isPromise(returnValue)) { | ||
returnValue.then(onSuccess, onFailure); | ||
return; | ||
} | ||
} catch (error) { | ||
onFailure(error); | ||
return; | ||
} | ||
onSuccess(returnValue); | ||
}; | ||
var forArray = exports.forArray = function (array, iteratee) { | ||
@@ -32,0 +14,0 @@ var length = array.length; |
"use strict"; | ||
var identity = require("./_identity"); | ||
var isPromise = require("./isPromise"); | ||
var toPromise = require("./_resolve"); | ||
var noop = Function.prototype; | ||
function step(key, value) { | ||
@@ -9,5 +15,6 @@ var cursor; | ||
try { | ||
cursor = this.iterator[key](value); | ||
cursor = this._iterator[key](value); | ||
} catch (error) { | ||
return this.reject(error); | ||
this.finally(); | ||
return this._reject(error); | ||
} | ||
@@ -18,5 +25,7 @@ | ||
if (cursor.done) { | ||
this.resolve(value); | ||
this.finally(); | ||
this._resolve(value); | ||
} else { | ||
this.toPromise(value).then(this.onFulfill, this.onReject); | ||
this.toPromise(value).then(this.next, this._throw); | ||
} | ||
@@ -26,10 +35,12 @@ } | ||
function AsyncFn(iterator, resolve, reject) { | ||
this.iterator = iterator; | ||
this.onFulfill = step.bind(this, "next"); | ||
this.onReject = step.bind(this, "throw"); | ||
this.reject = reject; | ||
this.resolve = resolve; | ||
this.toPromise = toPromise; | ||
this._iterator = iterator; | ||
this._reject = reject; | ||
this._resolve = resolve; | ||
this._throw = step.bind(this, "throw"); | ||
this.next = step.bind(this, "next"); | ||
} | ||
AsyncFn.prototype.finally = noop; | ||
AsyncFn.prototype.toPromise = toPromise; | ||
var asyncFn = function asyncFn(generator) { | ||
@@ -41,3 +52,3 @@ return function () { | ||
return new Promise(function (resolve, reject) { | ||
return new AsyncFn(generator.apply(_this, _arguments), resolve, reject).onFulfill(); | ||
return new AsyncFn(generator.apply(_this, _arguments), resolve, reject).next(); | ||
}); | ||
@@ -47,7 +58,47 @@ }; | ||
asyncFn.cancelable = function (generator) { | ||
return function (cancelToken) { | ||
function CancelabledAsyncFn(cancelToken) { | ||
var _this2 = this; | ||
AsyncFn.apply(this, [].slice.call(arguments, 1)); | ||
this._cancelToken = cancelToken; | ||
this._onCancel = noop; | ||
this.finally = cancelToken.addHandler(function (reason) { | ||
_this2._onCancel(reason); | ||
return new Promise(function (resolve) { | ||
_this2.finally = resolve; | ||
}); | ||
}); | ||
} | ||
Object.setPrototypeOf(CancelabledAsyncFn.prototype, Object.getPrototypeOf(AsyncFn.prototype)).toPromise = function (value) { | ||
var _this3 = this; | ||
if (Array.isArray(value)) { | ||
return toPromise(value[0]); | ||
} | ||
var cancelToken = this._cancelToken; | ||
if (cancelToken.requested) { | ||
return Promise.reject(cancelToken.reason); | ||
} | ||
return isPromise(value) ? new Promise(function (resolve, reject) { | ||
value.then(resolve, reject); | ||
_this3._onCancel = reject; | ||
}) : Promise.resolve(value); | ||
}; | ||
asyncFn.cancelable = function (generator, getCancelToken) { | ||
if (getCancelToken === void 0) { | ||
getCancelToken = identity; | ||
} | ||
return function () { | ||
var _arguments2 = arguments, | ||
_this2 = this; | ||
_this4 = this; | ||
var cancelToken = getCancelToken.apply(this, arguments); | ||
if (cancelToken.requested) { | ||
@@ -58,16 +109,3 @@ return Promise.reject(cancelToken.reason); | ||
return new Promise(function (resolve, reject) { | ||
var o = new AsyncFn(generator.apply(_this2, _arguments2), resolve, reject); | ||
var cancelPromise = cancelToken.promise; | ||
cancelPromise.then(function () { | ||
o.toPromise = toPromise; | ||
}); | ||
o.toPromise = function (promise) { | ||
return new Promise(function (resolve, reject) { | ||
toPromise(promise).then(resolve, reject); | ||
cancelPromise.then(reject); | ||
}); | ||
}; | ||
o.onFulfill(); | ||
new CancelabledAsyncFn(cancelToken, generator.apply(_this4, _arguments2), resolve, reject).next(); | ||
}); | ||
@@ -74,0 +112,0 @@ }; |
@@ -31,2 +31,8 @@ "use strict"; | ||
var onabort = this.onabort; | ||
if (typeof onabort === "function") { | ||
onabort(); | ||
} | ||
var handlers = this._handlers; | ||
@@ -100,2 +106,12 @@ | ||
var CancelToken = function () { | ||
CancelToken.from = function from(abortSignal) { | ||
if (CancelToken.isCancelToken(abortSignal)) { | ||
return abortSignal; | ||
} | ||
var token = new CancelToken(INTERNAL); | ||
abortSignal.addEventListener("abort", cancel.bind(token)); | ||
return token; | ||
}; | ||
CancelToken.isCancelToken = function isCancelToken(value) { | ||
@@ -114,2 +130,3 @@ return value != null && value[$$toStringTag] === cancelTokenTag; | ||
this._resolve = undefined; | ||
this.onabort = undefined; | ||
@@ -146,2 +163,16 @@ if (executor !== INTERNAL) { | ||
_proto.addEventListener = function addEventListener(event, listener) { | ||
if (event !== "abort") { | ||
return; | ||
} | ||
if (typeof listener !== "function") { | ||
listener = listener.handleEvent.bind(listener); | ||
} | ||
this.addHandler(listener); | ||
}; | ||
_proto.removeEventListener = function removeEventListener() {}; | ||
_createClass(CancelToken, [{ | ||
@@ -178,2 +209,7 @@ key: "promise", | ||
} | ||
}, { | ||
key: "aborted", | ||
get: function get() { | ||
return this.requested; | ||
} | ||
}]); | ||
@@ -180,0 +216,0 @@ |
"use strict"; | ||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } | ||
var evalDisposable = require("./_evalDisposable"); | ||
@@ -15,39 +19,66 @@ | ||
function Disposable(value, dispose) { | ||
if (typeof dispose !== "function") { | ||
throw new Error("dispose must be a function"); | ||
var Disposable = function () { | ||
function Disposable(dispose, value) { | ||
if (typeof dispose !== "function") { | ||
throw new Error("dispose must be a function"); | ||
} | ||
this._dispose = dispose; | ||
this._value = value; | ||
} | ||
this.dispose = dispose; | ||
this.value = value; | ||
} | ||
var _proto = Disposable.prototype; | ||
_proto.dispose = function dispose() { | ||
if (this._dispose === undefined) { | ||
throw new TypeError("this disposable has already been disposed"); | ||
} | ||
var d = this._dispose; | ||
this._dispose = this._value = undefined; | ||
return d(); | ||
}; | ||
_createClass(Disposable, [{ | ||
key: "value", | ||
get: function get() { | ||
if (this._dispose === undefined) { | ||
throw new TypeError("this disposable has already been disposed"); | ||
} | ||
return this._value; | ||
} | ||
}]); | ||
return Disposable; | ||
}(); | ||
module.exports = Disposable; | ||
Disposable.all = function all(disposables) { | ||
var disposers = []; | ||
Disposable.all = function all(iterable) { | ||
var disposables = []; | ||
var dispose = function dispose() { | ||
var d = disposers; | ||
disposers = undefined; | ||
d.forEach(function (disposer) { | ||
return disposer(); | ||
var d = disposables; | ||
disposables = undefined; | ||
d.forEach(function (disposable) { | ||
return disposable.dispose(); | ||
}); | ||
}; | ||
var onFulfill = function onFulfill(disposable) { | ||
if (disposers === undefined) { | ||
return isDisposable(disposable) && disposable.dispose(); | ||
var onFulfill = function onFulfill(maybeDisposable) { | ||
if (disposables === undefined) { | ||
return isDisposable(maybeDisposable) && maybeDisposable.dispose(); | ||
} | ||
if (isDisposable(disposable)) { | ||
disposers.push(disposable.dispose); | ||
return disposable.value; | ||
if (isDisposable(maybeDisposable)) { | ||
disposables.push(maybeDisposable); | ||
return maybeDisposable.value; | ||
} | ||
return disposable; | ||
return maybeDisposable; | ||
}; | ||
var onReject = function onReject(error) { | ||
if (disposers === undefined) { | ||
if (disposables === undefined) { | ||
return; | ||
@@ -60,6 +91,6 @@ } | ||
return Promise.all(Array.from(disposables, function (disposable) { | ||
return evalDisposable(disposable).then(onFulfill, onReject); | ||
return Promise.all(Array.from(iterable, function (maybeDisposable) { | ||
return evalDisposable(maybeDisposable).then(onFulfill, onReject); | ||
})).then(function (values) { | ||
return new Disposable(values, dispose); | ||
return new Disposable(dispose, values); | ||
}); | ||
@@ -92,5 +123,5 @@ }; | ||
return loop().then(function (value) { | ||
return new Disposable(value, function () { | ||
return new Disposable(function () { | ||
return wrapCall(gen.return, undefined, gen).then(dispose); | ||
}); | ||
}, value); | ||
}, function (error) { | ||
@@ -136,3 +167,3 @@ var forwardError = function forwardError() { | ||
if (nDisposables < 0) { | ||
throw new TypeError("using expects at least 1 arguments"); | ||
throw new TypeError("Disposable.use expects at least 1 argument"); | ||
} | ||
@@ -150,7 +181,7 @@ | ||
return Disposable.all(disposables).then(function (_ref2) { | ||
var dispose = _ref2.dispose, | ||
value = _ref2.value; | ||
return pFinally((spread ? wrapApply : wrapCall)(handler, value, _this).then(onHandlerFulfill), dispose); | ||
return Disposable.all(disposables).then(function (dAll) { | ||
return pFinally((spread ? wrapApply : wrapCall)(handler, dAll.value, _this).then(onHandlerFulfill), function () { | ||
return dAll.dispose(); | ||
}); | ||
}); | ||
}; |
"use strict"; | ||
exports.pAll = exports.all = require("./all"); | ||
exports.pAsCallback = exports.asCallback = require("./asCallback"); | ||
@@ -25,3 +24,2 @@ exports.pAsyncFn = exports.asyncFn = require("./asyncFn"); | ||
exports.pMakeAsyncIterator = exports.makeAsyncIterator = require("./makeAsyncIterator"); | ||
exports.pMap = exports.map = require("./map"); | ||
exports.pNodeify = exports.nodeify = require("./nodeify"); | ||
@@ -33,3 +31,2 @@ exports.pPipe = exports.pipe = require("./pipe"); | ||
exports.pRetry = exports.retry = require("./retry"); | ||
exports.pSettle = exports.settle = require("./settle"); | ||
exports.pSome = exports.some = require("./some"); | ||
@@ -43,4 +40,3 @@ exports.pSuppressUnhandledRejections = exports.suppressUnhandledRejections = require("./suppressUnhandledRejections"); | ||
exports.pUnpromisify = exports.unpromisify = require("./unpromisify"); | ||
exports.pUsing = exports.using = require("./using"); | ||
exports.pWrapApply = exports.wrapApply = require("./wrapApply"); | ||
exports.pWrapCall = exports.wrapCall = require("./wrapCall"); |
{ | ||
"name": "promise-toolbox", | ||
"version": "0.18.1", | ||
"version": "0.19.0", | ||
"license": "ISC", | ||
@@ -5,0 +5,0 @@ "description": "Essential utils for promises", |
131
README.md
@@ -20,2 +20,3 @@ # promise-toolbox | ||
- [Is cancel token?](#is-cancel-token) | ||
- [Compatibility with AbortSignal](#compatibility-with-abortsignal) | ||
- [@cancelable decorator](#cancelable-decorator) | ||
@@ -28,3 +29,3 @@ - [Resource management](#resource-management) | ||
- [asyncFn(generator)](#asyncfngenerator) | ||
- [asyncFn.cancelable(generator)](#asyncfncancelablegenerator) | ||
- [asyncFn.cancelable(generator, [getCancelToken])](#asyncfncancelablegenerator-getcanceltoken) | ||
- [defer()](#defer) | ||
@@ -39,7 +40,6 @@ - [fromCallback(fn, arg1, ..., argn)](#fromcallbackfn-arg1--argn) | ||
- [promisify(fn, [ context ]) / promisifyAll(obj)](#promisifyfn--context---promisifyallobj) | ||
- [retry(fn, options, ...arg)](#retryfn-options-arg) | ||
- [retry(fn, options, [args])](#retryfn-options-args) | ||
- [try(fn)](#tryfn) | ||
- [wrapApply(fn, args, [thisArg]) / wrapCall(fn, arg, [thisArg])](#wrapapplyfn-args-thisarg--wrapcallfn-arg-thisarg) | ||
- [Pseudo-methods](#pseudo-methods) | ||
- [promises::all([ mapper ])](#promisesall-mapper-) | ||
- [promise::asCallback(cb)](#promiseascallbackcb) | ||
@@ -195,2 +195,4 @@ - [promise::catch(predicate, cb)](#promisecatchpredicate-cb) | ||
See [`asyncFn.cancelable`](#asyncfncancelablegenerator) for an easy way to create async functions with built-in cancelation support. | ||
#### Registering async handlers | ||
@@ -241,2 +243,14 @@ | ||
> **This is deprecated, instead explicitely pass a cancel token or an abort signal:** | ||
```js | ||
const asyncFunction = async (a, b, { cancelToken = CancelToken.none } = {}) => { | ||
cancelToken.promise.then(() => { | ||
// do stuff regarding the cancelation request. | ||
}); | ||
// do other stuff. | ||
}; | ||
``` | ||
> Make your async functions cancelable. | ||
@@ -281,2 +295,20 @@ | ||
#### Compatibility with AbortSignal | ||
A cancel token can be created from an abort signal: | ||
```js | ||
const token = CancelToken.from(abortSignal); | ||
``` | ||
> If `abortSignal` is already a `CancelToken`, it will be returned directly, making it a breeze to create code accepting both :-) | ||
A cancel token is API compatible with an abort signal and can be used as such: | ||
```js | ||
const { cancel, token } = CancelToken.source(); | ||
await fetch(url, { signal: token }); | ||
``` | ||
### Resource management | ||
@@ -288,8 +320,10 @@ | ||
A disposable is a simple object, containing a value and a dispose function: | ||
A disposable is a simple object, which contains a dispose method and possibily a value: | ||
```js | ||
const disposable = { value: db, dispose: () => db.close() }; | ||
const disposable = { dispose: () => db.close(), value: db }; | ||
``` | ||
The dispose method may be asynchronous and return a promise. | ||
As a convenience, you can use the `Disposable` class: | ||
@@ -300,3 +334,3 @@ | ||
const disposable = new Disposable(db, () => db.close()); | ||
const disposable = new Disposable(() => db.close(), db); | ||
``` | ||
@@ -395,3 +429,3 @@ | ||
#### asyncFn.cancelable(generator) | ||
#### asyncFn.cancelable(generator, [getCancelToken]) | ||
@@ -426,2 +460,42 @@ > Like [`asyncFn(generator)`](#asyncfngenerator) but the created async function supports [cancelation](#cancelation). | ||
```js | ||
const cancelableAsyncFunction = asyncFn.cancelable(function*( | ||
cancelToken, | ||
...args | ||
) { | ||
// await otherAsyncFunction() but will throw if cancelToken is activated | ||
yield otherAsyncFunction(); | ||
// if aborting on cancelation is unwanted (eg because the called function | ||
// already handles cancelation), wrap the promise in an array | ||
yield [otherAsyncFunction(cancelToken)]; | ||
// cancelation, just like any rejection, can be catch | ||
try { | ||
yield otherAsyncFunction(); | ||
} catch (error) { | ||
if (CancelToken.isCancelToken(error)) { | ||
// do some clean-up here | ||
// the rest of the function has been added as an async handler of the | ||
// CancelToken which will make `cancel` waits for it | ||
} | ||
throw error; | ||
} | ||
return result; | ||
}); | ||
``` | ||
If the cancel token is not the first param of the decorated function, a getter should be passed to `asyncFn.cancelable`, it's called with the same context and arguments as the decorated function and returns the cancel token: | ||
```js | ||
const cancelableAsyncFunction = asyncFn.cancelable( | ||
function*(arg1, arg2, options) { | ||
// function logic | ||
}, | ||
(_arg1, _arg2, { cancelToken = CancelToken.none } = {}) => cancelToken; | ||
); | ||
``` | ||
#### defer() | ||
@@ -599,3 +673,3 @@ | ||
#### retry(fn, options, ...arg) | ||
#### retry(fn, options, [args]) | ||
@@ -682,2 +756,13 @@ > Retries an async function when it fails. | ||
In that case `options` can also be a function which will be used to compute the options from the context and the arguments: | ||
```js | ||
MyClass.prototype.myMethod = retry.wrap( | ||
MyClass.prototype.myMethod, | ||
function getOptions(arg1, arg2) { | ||
return this._computeRetryOptions(arg1, arg2); | ||
} | ||
); | ||
``` | ||
#### try(fn) | ||
@@ -748,32 +833,2 @@ | ||
#### promises::all([ mapper ]) | ||
> Waits for all promises of a collection to be resolved. | ||
> | ||
> Contrary to the standard `Promise.all()`, this function works also | ||
> with objects. | ||
```js | ||
import { all } from 'promise-toolbox' | ||
[ | ||
Promise.resolve('foo'), | ||
Promise.resolve('bar') | ||
]::all().then(value => { | ||
console.log(value) | ||
// → ['foo', 'bar'] | ||
}) | ||
{ | ||
foo: Promise.resolve('foo'), | ||
bar: Promise.resolve('bar') | ||
}::all().then(value => { | ||
console.log(value) | ||
// → { | ||
// foo: 'foo', | ||
// bar: 'bar' | ||
// } | ||
}) | ||
``` | ||
#### promise::asCallback(cb) | ||
@@ -780,0 +835,0 @@ |
11
retry.js
@@ -9,3 +9,3 @@ "use strict"; | ||
function retry(fn, _temp) { | ||
function retry(fn, _temp, args) { | ||
var _this = this; | ||
@@ -94,4 +94,2 @@ | ||
var args = Array.prototype.slice.call(arguments, 2); | ||
var loopResolver = function loopResolver(resolve) { | ||
@@ -119,7 +117,8 @@ return resolve(fn.apply(_this, args)); | ||
retry.wrap = function retryWrap(fn, options) { | ||
var getOptions = typeof options !== "function" ? function () { | ||
return options; | ||
} : options; | ||
return setFunctionNameAndLength(function () { | ||
var args = [fn, options]; | ||
args.push.apply(args, arguments); | ||
return retry.apply(this, args); | ||
return retry.call(this, fn, getOptions.apply(this, arguments), Array.from(arguments)); | ||
}, fn.name, fn.length); | ||
}; |
@@ -1,1 +0,1 @@ | ||
(function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;b="undefined"==typeof window?"undefined"==typeof global?"undefined"==typeof self?this:self:global:window,b.promiseToolbox=a()}})(function(){return function(){function b(d,e,g){function a(j,i){if(!e[j]){if(!d[j]){var f="function"==typeof require&&require;if(!i&&f)return f(j,!0);if(h)return h(j,!0);var c=new Error("Cannot find module '"+j+"'");throw c.code="MODULE_NOT_FOUND",c}var k=e[j]={exports:{}};d[j][0].call(k.exports,function(b){var c=d[j][1][b];return a(c||b)},k,k.exports,b,d,e,g)}return e[j].exports}for(var h="function"==typeof require&&require,c=0;c<g.length;c++)a(g[c]);return a}return b}()({1:[function(a,b){"use strict";b.exports=function(){function a(a){void 0===a&&(a="this action has been canceled"),Object.defineProperty(this,"message",{enumerable:!0,value:a})}var b=a.prototype;return b.toString=function(){return`Cancel: ${this.message}`},a}()},{}],2:[function(a,b){"use strict";function c(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}function d(a,b,d){return b&&c(a.prototype,b),d&&c(a,d),a}function e(a){if(void 0===this._reason){var b=this._reason=a instanceof j?a:new j(a),c=this._resolve;void 0!==c&&(this._resolve=void 0,c(b));var d=this._handlers;if(void 0!==d){this._handlers=void 0;for(var e=h(),f=e.promise,g=e.resolve,l=0,m=function(){if(0==--l)return g()},o=0,p=d.length;o<p;++o)try{var n=d[o](b);k(n)&&(++l,n.then(m,m))}catch(a){}if(0!==l)return f}}}function f(a){var b=this._handlers;if(b!==void 0){var c=b.indexOf(a);-1!==c&&b.splice(c,1)}}function g(a){var b=this.cancel=e.bind(this.token=new p(o));null==a||a.forEach(function(a){var c=a.reason;return void 0===c?void a.addHandler(b):(b(c),!1)})}var h=a("./defer"),j=a("./Cancel"),k=a("./isPromise"),l=a("./_symbols"),m=l.$$toStringTag,n="CancelToken",o={},p=function(){function a(a){this._handlers=void 0,this._promise=void 0,this._reason=void 0,this._resolve=void 0,a!==o&&a(e.bind(this))}a.isCancelToken=function(a){return null!=a&&a[m]===n},a.source=function(a){return new g(a)};var b=a.prototype;return b.addHandler=function(a){var b=this._handlers;if(void 0===b){if(this.requested)throw new TypeError("cannot add a handler to an already canceled token");b=this._handlers=[]}return b.push(a),f.bind(this,a)},b.throwIfRequested=function(){var a=this._reason;if(void 0!==a)throw a},d(a,[{key:"promise",get:function(){var a=this,b=this._promise;if(void 0===b){var c=this._reason;b=this._promise=void 0===c?new Promise(function(b){a._resolve=b}):Promise.resolve(c)}return b}},{key:"reason",get:function(){return this._reason}},{key:"requested",get:function(){return void 0!==this._reason}},{key:m,get:function(){return n}}]),a}();e.call(p.canceled=new p(o)),p.none=new p(o),b.exports=p},{"./Cancel":1,"./_symbols":17,"./defer":24,"./isPromise":37}],3:[function(a,b){"use strict";function c(a,b){if("function"!=typeof b)throw new Error("dispose must be a function");this.dispose=b,this.value=a}var d=a("./_evalDisposable"),e=a("./_isDisposable"),f=a("./_finally"),g=a("./_setFunctionNameAndLength"),h=a("./wrapApply"),i=a("./wrapCall");b.exports=c,c.all=function(a){var b=[],f=function(){var a=b;b=void 0,a.forEach(function(a){return a()})},g=function(a){return void 0===b?e(a)&&a.dispose():e(a)?(b.push(a.dispose),a.value):a},h=function(a){if(void 0!==b)throw f(),a};return Promise.all(Array.from(a,function(a){return d(a).then(g,h)})).then(function(a){return new c(a,f)})};var j=a("./_ExitStack");c.factory=function(a){return g(function(){var b=a.apply(this,arguments),f=new j,g=f.dispose,h=f.value,k=function(a){return e(a)?m(h.enter(a)):a},l=function(a){var b=a.value;return d(b).then(k)},m=function(a){return i(b.next,a,b).then(l)};return m().then(function(a){return new c(a,function(){return i(b.return,void 0,b).then(g)})},function(a){var b=function(){throw a};return g().then(b,b)})},a.name,a.length)};var k=function(a){if(null==a||"function"!=typeof a.next)return a;var b=new j,c=b.dispose,e=b.value,g=function(a){return k(e.enter(a))},h=function(a){return a.done?a.value:d(a.value).then(g)},k=function(b){return i(a.next,b,a).then(h)};return f(k(),c)};c.use=function(){var a=this,b=arguments.length-1;if(0>b)throw new TypeError("using expects at least 1 arguments");var d,e=arguments[b],g=1<b||!Array.isArray(d=arguments[0]);return g?d=Array.prototype.slice.call(arguments,0,b):b=d.length,c.all(d).then(function(b){var c=b.dispose,d=b.value;return f((g?h:i)(e,d,a).then(k),c)})}},{"./_ExitStack":5,"./_evalDisposable":6,"./_finally":7,"./_isDisposable":9,"./_setFunctionNameAndLength":16,"./wrapApply":56,"./wrapCall":57}],4:[function(a,b){"use strict";function c(a,b){a.prototype=Object.create(b.prototype),a.prototype.constructor=a,d(a,b)}function d(a,b){return d=Object.setPrototypeOf||function(a,b){return a.__proto__=b,a},d(a,b)}var e=a("make-error"),f=e.BaseError;b.exports=function(a){function b(){return a.call(this,"operation timed out")||this}return c(b,a),b}(f)},{"make-error":40}],5:[function(a,b){"use strict";var c=a("./Disposable"),d=a("./_isDisposable"),e=a("./try");b.exports=function(){function a(){var a=this;this._disposers=[];return new c(this,function b(){var c=a._disposers.pop();return void 0===c?Promise.resolve():e(c).then(b)})}var b=a.prototype;return b.enter=function(a){if(!d(a))throw new TypeError("not a disposable");return this._disposers.push(a.dispose),a.value},a}()},{"./Disposable":3,"./_isDisposable":9,"./try":53}],6:[function(a,b){"use strict";var c=a("./try");b.exports=function(a){return"function"==typeof a?c(a):Promise.resolve(a)}},{"./try":53}],7:[function(a,b){"use strict";b.exports=function(a,b){return a.then(b,b).then(function(){return a})}},{}],8:[function(a,b){"use strict";b.exports=function(a){return a}},{}],9:[function(a,b){"use strict";b.exports=function(a){return null!=a&&"function"==typeof a.dispose}},{}],10:[function(a,b){"use strict";b.exports=function(a){return a instanceof ReferenceError||a instanceof SyntaxError||a instanceof TypeError}},{}],11:[function(a,b){"use strict";var c=a("./_noop"),d=a("./_once");b.exports=function(a,b,e){var f=b.addEventListener||b.addListener||b.on;if(void 0===f)throw new Error("cannot register event listener");var g=b.removeEventListener||b.removeListener||b.off,h=[],i=c;return void 0!==g&&(i=d(function(){for(var a=0,c=h.length;a<c;a+=2)g.call(b,h[a],h[a+1])}),a.promise.then(i)),e?function(a,c){function d(){i();var b=Array.prototype.slice.call(arguments);b.args=b,b.event=b.name=a,c(b)}h.push(a,d),f.call(b,a,d)}:function(a,c){var d=function(a){i(),c(a)};h.push(a,d),f.call(b,a,d)}}},{"./_noop":13,"./_once":14}],12:[function(a,b){"use strict";var c=a("./_isProgrammerError");b.exports=function a(b,d){if(b===void 0)return!c(d);var e=typeof b;if("boolean"==e)return b;if("function"==e)return b===Error||b.prototype instanceof Error?d instanceof b:b(d);if(Array.isArray(b)){for(var f=b.length,g=0;g<f;++g)if(a(b[g],d))return!0;return!1}if(null!=d&&"object"===e){for(var h in b)if(hasOwnProperty.call(b,h)&&d[h]!==b[h])return!1;return!0}}},{"./_isProgrammerError":10}],13:[function(a,b){"use strict";b.exports=Function.prototype},{}],14:[function(a,b){"use strict";b.exports=function(a){var b;return function(){return void 0!==a&&(b=a.apply(this,arguments),a=void 0),b}}},{}],15:[function(a,b){"use strict";var c=a("./isPromise");b.exports=function(a){return c(a)?a:Promise.resolve(a)}},{"./isPromise":37}],16:[function(a,b){"use strict";b.exports=function(){var b=Object.defineProperties;try{var c=b(function(){},{length:{value:2},name:{value:"foo"}});if(2===c.length&&"foo"===c.name)return function(a,c,d){return b(a,{length:{configurable:!0,value:0<d?d:0},name:{configurable:!0,value:c}})}}catch(a){}return a("./_identity")}()},{"./_identity":8}],17:[function(a,b,c){"use strict";var d="function"==typeof Symbol?function(a){var b=Symbol[a];return b===void 0?`@@${a}`:b}:function(a){return`@@${a}`};c.$$iterator=d("iterator"),c.$$toStringTag=d("toStringTag")},{}],18:[function(a,b,c){"use strict";if("function"!=typeof Promise||"function"!=typeof Promise.reject||"function"!=typeof Promise.resolve)throw new Error("a standard Promise implementation is required (https://github.com/JsCommunity/promise-toolbox#usage)");var d=a("./isPromise"),e=a("./_symbols"),f=e.$$iterator;c.applyThen=function(a,b,c,e){var f;try{if(f=a.apply(void 0,b),d(f))return void f.then(c,e)}catch(a){return void e(a)}c(f)};var g=c.forArray=function(a,b){for(var c=a.length,d=0;d<c;++d)b(a[d],d,a)};c.forIn=function(a,b){for(var c in a)b(a[c],c,a)};var h=c.forIterable=function(a,b){for(var c,d=a[f]();!(c=d.next()).done;)b(c.value,void 0,a)},i=Object.prototype.hasOwnProperty,j=c.forOwn=function(a,b){for(var c in a)i.call(a,c)&&b(a[c],c,a)},k=function(a){return null!=a&&"function"==typeof a[f]},l=c.forEach=function(a,b){return Array.isArray(a)?g(a,b):k(a)?h(a,b):n(a)?g(a,b):j(a,b)},m=function(a){return"number"==typeof a&&0<=a&&a<1/0&&Math.floor(a)===a},n=c.isArrayLike=function(a){return"function"!=typeof a&&null!=a&&m(a.length)};c.makeAsyncIterator=function(a){return function b(c,e){if(d(c))return c.then(function(a){return b(a,e)});var f=Promise.resolve();return a(c,function(a,b){f=d(a)?f.then(function(){return a.then(function(a){return e(a,b,c)})}):f.then(function(){return e(a,b,c)})}),f}},c.map=function(a,b){var c=[];return l(a,function(a,d,e){c.push(b(a,d,e))}),c},c.mapAuto=function(a,b){var c=n(a)?Array(a.length):Object.create(null);return void 0!==b&&l(a,function(a,d,e){c[d]=b(a,d,e)}),c}},{"./_symbols":17,"./isPromise":37}],19:[function(a,b){"use strict";var c=a("./isPromise"),d=a("./_utils"),e=d.forEach,f=d.mapAuto,g=function(a,b){return new Promise(function(d,g){var h=f(a,b),i=1,j=function(){if(0==--i){var a=h;h=void 0,d(a)}},k=function(a,b){h&&(h[b]=a,j())},l=function(a){h&&(h=void 0,g(a))};e(b===void 0?a:h,function(a,b){++i,c(a)?a.then(function(a){return k(a,b)},l):k(a,b)}),j()})};b.exports=function(a){return c(this)?this.then(function(b){return g(b,a)}):g(this,a)}},{"./_utils":18,"./isPromise":37}],20:[function(a,b){"use strict";b.exports=function(a){return"function"==typeof a&&this.then(function(b){return a(void 0,b)},a),this}},{}],21:[function(a,b){"use strict";function c(a,b){var c;try{c=this.iterator[a](b)}catch(a){return this.reject(a)}b=c.value,c.done?this.resolve(b):this.toPromise(b).then(this.onFulfill,this.onReject)}function d(a,b,d){this.iterator=a,this.onFulfill=c.bind(this,"next"),this.onReject=c.bind(this,"throw"),this.reject=d,this.resolve=b,this.toPromise=e}var e=a("./_resolve"),f=function(a){return function(){var b=arguments,c=this;return new Promise(function(e,f){return new d(a.apply(c,b),e,f).onFulfill()})}};f.cancelable=function(a){return function(b){var c=arguments,f=this;return b.requested?Promise.reject(b.reason):new Promise(function(g,h){var i=new d(a.apply(f,c),g,h),j=b.promise;j.then(function(){i.toPromise=e}),i.toPromise=function(a){return new Promise(function(b,c){e(a).then(b,c),j.then(c)})},i.onFulfill()})}},b.exports=f},{"./_resolve":15}],22:[function(a,b){"use strict";var c=a("./_setFunctionNameAndLength"),d=a("./CancelToken"),e=d.isCancelToken,f=d.source;b.exports=function(a,b,d){var g=d===void 0?a:d.value,h=c(function(){var a=arguments.length;if(0!==a&&e(arguments[0]))return g.apply(this,arguments);var b=f(),c=b.cancel,d=b.token,h=Array(a+1);h[0]=d;for(var j=0;j<a;++j)h[j+1]=arguments[j];var k=g.apply(this,h);return k.cancel=c,k},g.name,g.length-1);return void 0===d?h:(d.value=h,d)}},{"./CancelToken":2,"./_setFunctionNameAndLength":16}],23:[function(a,b){"use strict";function c(a,b,c){return d(a,c)?b(c):this}var d=a("./_matchError");b.exports=function(){var a,b=arguments.length;return 0===b||"function"!=typeof(a=arguments[--b])?this:this.then(void 0,c.bind(this,0===b?void 0:1===b?arguments[0]:Array.prototype.slice.call(arguments,0,b),a))}},{"./_matchError":12}],24:[function(a,b){"use strict";b.exports=function(){var a,b,c=new Promise(function(c,d){a=c,b=d});return{promise:c,reject:b,resolve:a}}},{}],25:[function(a,b){"use strict";var c=a("./isPromise");b.exports=function(a){var b=2===arguments.length?arguments[1]:this;if(c(b))return b.then(function(b){return new Promise(function(c){setTimeout(c,a,b)})});var d,e=new Promise(function(c){d=setTimeout(c,a,b)});return e.unref=function(){return null!=d&&"function"==typeof d.unref&&d.unref(),e},e}},{"./isPromise":37}],26:[function(a,b){"use strict";b.exports=function(a){var b=this;return this.then(a,a).then(function(){return b})}},{}],27:[function(a,b){"use strict";b.exports=a("./makeAsyncIterator")(a("./_utils").forArray)},{"./_utils":18,"./makeAsyncIterator":38}],28:[function(a,b){"use strict";b.exports=a("./makeAsyncIterator")(a("./_utils").forEach)},{"./_utils":18,"./makeAsyncIterator":38}],29:[function(a,b){"use strict";b.exports=a("./makeAsyncIterator")(a("./_utils").forIn)},{"./_utils":18,"./makeAsyncIterator":38}],30:[function(a,b){"use strict";b.exports=a("./makeAsyncIterator")(a("./_utils").forIterable)},{"./_utils":18,"./makeAsyncIterator":38}],31:[function(a,b){"use strict";b.exports=a("./makeAsyncIterator")(a("./_utils").forOwn)},{"./_utils":18,"./makeAsyncIterator":38}],32:[function(a,b){"use strict";function c(a,b,c,d){b.push(function(a,b){return null!=a&&!1!==a?d(a):c(b)}),a.apply(this,b)}b.exports=function(a){for(var b=arguments.length,d=Array(1<b?b-1:0),e=1;e<b;e++)d[e-1]=arguments[e];return new Promise(c.bind(this,"function"==typeof a?a:this[a],d))}},{}],33:[function(a,b){"use strict";var c=a("./cancelable"),d=a("./_makeEventAdder"),e=c(function(a,b,c,e){return void 0===e&&(e={}),new Promise(function(f,g){var h=d(a,b,e.array);if(h(c,f),!e.ignoreErrors){var i=e,j=i.error,k=void 0===j?"error":j;k!==c&&h(k,g)}})});b.exports=e},{"./_makeEventAdder":11,"./cancelable":22}],34:[function(a,b){"use strict";var c=a("./cancelable"),d=a("./_makeEventAdder"),e=a("./_utils"),f=e.forArray,g=c(function(a,b,c,e){return void 0===e&&(e=["error"]),new Promise(function(g,h){var i=d(a,b,!0);f(c,function(a){return i(a,g)}),f(e,function(a){return i(a,h)})})});b.exports=g},{"./_makeEventAdder":11,"./_utils":18,"./cancelable":22}],35:[function(a,b){"use strict";var c=a("./_isProgrammerError"),d=function(a){if(c(a))throw a};b.exports=function(){return this.then(void 0,d)}},{"./_isProgrammerError":10}],36:[function(a,b,c){"use strict";c.pAll=c.all=a("./all"),c.pAsCallback=c.asCallback=a("./asCallback"),c.pAsyncFn=c.asyncFn=a("./asyncFn"),c.pCancel=c.Cancel=a("./Cancel"),c.pCancelable=c.cancelable=a("./cancelable"),c.pCancelToken=c.CancelToken=a("./CancelToken"),c.pCatch=c.catch=a("./catch"),c.pDefer=c.defer=a("./defer"),c.pDelay=c.delay=a("./delay"),c.pDisposable=c.Disposable=a("./Disposable"),c.pFinally=c.finally=a("./finally"),c.pForArray=c.forArray=a("./forArray"),c.pForEach=c.forEach=a("./forEach"),c.pForIn=c.forIn=a("./forIn"),c.pForIterable=c.forIterable=a("./forIterable"),c.pForOwn=c.forOwn=a("./forOwn"),c.pFromCallback=c.fromCallback=a("./fromCallback"),c.pFromEvent=c.fromEvent=a("./fromEvent"),c.pFromEvents=c.fromEvents=a("./fromEvents"),c.pIgnoreErrors=c.ignoreErrors=a("./ignoreErrors"),c.pIsPromise=c.isPromise=a("./isPromise"),c.pMakeAsyncIterator=c.makeAsyncIterator=a("./makeAsyncIterator"),c.pMap=c.map=a("./map"),c.pNodeify=c.nodeify=a("./nodeify"),c.pPipe=c.pipe=a("./pipe"),c.pPromisify=c.promisify=a("./promisify"),c.pPromisifyAll=c.promisifyAll=a("./promisifyAll"),c.pReflect=c.reflect=a("./reflect"),c.pRetry=c.retry=a("./retry"),c.pSettle=c.settle=a("./settle"),c.pSome=c.some=a("./some"),c.pSuppressUnhandledRejections=c.suppressUnhandledRejections=a("./suppressUnhandledRejections"),c.pTap=c.tap=a("./tap"),c.pTapCatch=c.tapCatch=a("./tapCatch"),c.pTimeout=c.timeout=a("./timeout"),c.pTimeoutError=c.TimeoutError=a("./TimeoutError"),c.pTry=c.try=a("./try"),c.pUnpromisify=c.unpromisify=a("./unpromisify"),c.pUsing=c.using=a("./using"),c.pWrapApply=c.wrapApply=a("./wrapApply"),c.pWrapCall=c.wrapCall=a("./wrapCall")},{"./Cancel":1,"./CancelToken":2,"./Disposable":3,"./TimeoutError":4,"./all":19,"./asCallback":20,"./asyncFn":21,"./cancelable":22,"./catch":23,"./defer":24,"./delay":25,"./finally":26,"./forArray":27,"./forEach":28,"./forIn":29,"./forIterable":30,"./forOwn":31,"./fromCallback":32,"./fromEvent":33,"./fromEvents":34,"./ignoreErrors":35,"./isPromise":37,"./makeAsyncIterator":38,"./map":39,"./nodeify":41,"./pipe":42,"./promisify":43,"./promisifyAll":44,"./reflect":45,"./retry":46,"./settle":47,"./some":48,"./suppressUnhandledRejections":49,"./tap":50,"./tapCatch":51,"./timeout":52,"./try":53,"./unpromisify":54,"./using":55,"./wrapApply":56,"./wrapCall":57}],37:[function(a,b){"use strict";b.exports=function(a){return null!=a&&"function"==typeof a.then}},{}],38:[function(a,b){"use strict";var c=a("./_noop"),d=a("./_utils"),e=d.makeAsyncIterator;b.exports=function(a){var b=e(a);return function(a){return b(this,a).then(c)}}},{"./_noop":13,"./_utils":18}],39:[function(a,b){"use strict";var c=a("./defer"),d=a("./_identity"),e=a("./isPromise"),f=a("./_utils"),g=f.applyThen,h=f.forEach,i=function a(b,f){if(void 0===f&&(f=d),e(b))return b.then(function(b){return a(b,f)});var j,k=1,l=[],m=c(),n=m.promise,o=m.reject,p=m.resolve,q=function(){0==--k&&(void 0===j?p(l):o(j.error))},r=function(a){void 0===j&&(j={error:a}),q()},s=function a(b){var c=b[0];return e(c)?c.then(function(c){return b[0]=c,a(b)}):void g(f,b,function(a){l[b[3]]=a,q()},r)},t=0;return h(b,function(a,b,c){++k,s([a,b,c,t++])}),q(),n};b.exports=function(a){return i(this,a)}},{"./_identity":8,"./_utils":18,"./defer":24,"./isPromise":37}],40:[function(a,b,c){"use strict";function d(a){a!==void 0&&f(this,"message",{configurable:!0,value:a,writable:!0});var b=this.constructor.name;b!==void 0&&b!==this.name&&f(this,"name",{configurable:!0,value:b,writable:!0}),g(this,this.constructor)}var e="undefined"==typeof Reflect?void 0:Reflect.construct,f=Object.defineProperty,g=Error.captureStackTrace;g===void 0&&(g=function(a){var b=new Error;f(a,"stack",{configurable:!0,get:function(){var a=b.stack;return f(this,"stack",{configurable:!0,value:a,writable:!0}),a},set:function(b){f(a,"stack",{configurable:!0,value:b,writable:!0})}})}),d.prototype=Object.create(Error.prototype,{constructor:{configurable:!0,value:d,writable:!0}});var h=function(){function a(a,b){return f(a,"name",{configurable:!0,value:b})}try{var b=function(){};if(a(b,"foo"),"foo"===b.name)return a}catch(a){}}();c=b.exports=function(a,b){if(null==b||b===Error)b=d;else if("function"!=typeof b)throw new TypeError("super_ should be a function");var c;if("string"==typeof a)c=a,a=void 0===e?function(){b.apply(this,arguments)}:function(){return e(b,arguments,this.constructor)},void 0!==h&&(h(a,c),c=void 0);else if("function"!=typeof a)throw new TypeError("constructor should be either a string or a function");a.super_=a["super"]=b;var f={constructor:{configurable:!0,value:a,writable:!0}};return void 0!==c&&(f.name={configurable:!0,value:c,writable:!0}),a.prototype=Object.create(b.prototype,f),a},c.BaseError=d},{}],41:[function(a,b){"use strict";var c=a("./_setFunctionNameAndLength"),d=a("./wrapApply"),e=Array.prototype.slice;b.exports=function(a){return c(function(){var b,c=arguments.length-1;if(0>c||"function"!=typeof(b=arguments[c]))throw new TypeError("missing callback");var f=e.call(arguments,0,c);d(a,f).then(function(a){return b(void 0,a)},b)},a.name,a.length+1)}},{"./_setFunctionNameAndLength":16,"./wrapApply":56}],42:[function(a,b){"use strict";var c=Array.isArray,d=Array.prototype.slice,e=function(a,b){return a.then(b)};b.exports=function(a){return c(a)||(a=d.call(arguments)),"function"==typeof a[0]?function(b){return a.reduce(e,Promise.resolve(b))}:(a[0]=Promise.resolve(a[0]),a.reduce(e))}},{}],43:[function(a,b){"use strict";var c=a("./_setFunctionNameAndLength");b.exports=function(a,b){return c(function(){for(var c=this,d=arguments.length,e=Array(d+1),f=0;f<d;++f)e[f]=arguments[f];return new Promise(function(f,g){e[d]=function(a,b){return null!=a&&!1!==a?g(a):f(b)},a.apply(b===void 0?c:b,e)})},a.name,a.length-1)}},{"./_setFunctionNameAndLength":16}],44:[function(a,b){"use strict";var c=a("./promisify"),d=a("./_utils"),e=d.forIn,f=function(a,b){return!(b.endsWith("Sync")||b.endsWith("Async"))&&b};b.exports=function(a,b){var d=void 0===b?{}:b,g=d.mapper,h=void 0===g?f:g,i=d.target,j=void 0===i?{}:i,k=d.context,l=void 0===k?a:k;return e(a,function(b,d){var e;"function"==typeof b&&(e=h(b,d,a))&&(j[e]=c(b,l))}),j}},{"./_utils":18,"./promisify":43}],45:[function(a,b){"use strict";var c=function(){return!1},d=function(){return!0},e=function(a){return function(b){return{__proto__:a,value:function(){return b}}}}({isFulfilled:d,isPending:c,isRejected:c,reason:function(){throw new Error("no reason, the promise has resolved")}}),f=function(a){return function(b){return{__proto__:a,reason:function(){return b}}}}({isFulfilled:c,isPending:c,isRejected:d,value:function(){throw new Error("no value, the promise has rejected")}});b.exports=function(){return this.then(e,f)}},{}],46:[function(a,b){"use strict";function c(a,b){var c,g=this,h=void 0===b?{}:b,i=h.delay,j=h.delays,k=h.onRetry,l=void 0===k?f:k,m=h.retries,n=h.tries,o=h.when;if(j!==void 0){if(i!==void 0||n!==void 0||m!==void 0)throw new TypeError("delays is incompatible with delay, tries and retries");var p=j[Symbol.iterator]();c=function(){var a=p.next(),b=a.done,c=a.value;return!b&&(i=c,!0)}}else{if(n===void 0)n=void 0===m?10:m+1;else if(m!==void 0)throw new TypeError("retries and tries options are mutually exclusive");i===void 0&&(i=1e3),c=function(){return 0!=--n}}o=e.bind(void 0,o);var q=0,r=function(a){return setTimeout(a,i)},s=function(){return new Promise(r)},t=function(b){if(b instanceof d)throw b.error;if(o(b)&&c()){var e=Promise.resolve(l.call({arguments:u,attemptNumber:q++,delay:i,fn:a,this:g},b));return 0!==i&&(e=e.then(s)),e.then(w)}throw b},u=Array.prototype.slice.call(arguments,2),v=function(b){return b(a.apply(g,u))},w=function(){return new Promise(v).catch(t)};return w()}function d(a){this.error=a}var e=a("./_matchError"),f=a("./_noop"),g=a("./_setFunctionNameAndLength");b.exports=c,c.bail=function(a){throw new d(a)},c.wrap=function(a,b){return g(function(){var d=[a,b];return d.push.apply(d,arguments),c.apply(this,d)},a.name,a.length)}},{"./_matchError":12,"./_noop":13,"./_setFunctionNameAndLength":16}],47:[function(a,b){"use strict";var c=a("./all"),d=a("./reflect"),e=a("./_resolve");b.exports=function(){return c.call(this,function(a){var b;return(b=e(a),d).call(b)})}},{"./_resolve":15,"./all":19,"./reflect":45}],48:[function(a,b){"use strict";var c=a("./_resolve"),d=a("./_utils"),e=d.forEach,f=function(a,b){return new Promise(function(c,d){var f=[],g=[],h=function(a){f&&(f.push(a),0==--b&&(c(f),f=g=void 0))},i=-b,j=function(a){f&&(g.push(a),0==--i&&(d(g),f=g=void 0))};e(a,function(a){++i,c(a).then(h,j)})})};b.exports=function(a){return c(this).then(function(b){return f(b,a)})}},{"./_resolve":15,"./_utils":18}],49:[function(a,b){"use strict";var c=a("./_noop");b.exports=function(){var a=this.suppressUnhandledRejections;return"function"==typeof a?a.call(this):this.then(void 0,c),this}},{"./_noop":13}],50:[function(a,b){"use strict";b.exports=function(a,b){var c=this;return this.then(a,b).then(function(){return c})}},{}],51:[function(a,b){"use strict";b.exports=function(a){var b=this;return this.then(void 0,a).then(function(){return b})}},{}],52:[function(a,b){"use strict";var c=a("./TimeoutError");b.exports=function(a,b){var d=this;return 0===a?this:(void 0===b&&(b=new c),new Promise(function(c,e){var f=setTimeout(function(){if(f=void 0,"function"==typeof d.cancel&&d.cancel(),"function"==typeof b)try{c(b())}catch(a){e(a)}else e(b)},a);d.then(function(a){void 0!==f&&clearTimeout(f),c(a)},function(a){void 0!==f&&clearTimeout(f),e(a)})}))}},{"./TimeoutError":4}],53:[function(a,b){"use strict";var c=a("./_resolve");b.exports=function(a){try{return c(a())}catch(a){return Promise.reject(a)}}},{"./_resolve":15}],54:[function(a,b){"use strict";var c=a("./_setFunctionNameAndLength");b.exports=function(){var a=this;return c(function(){var b,c=arguments.length-1;if(0>c||"function"!=typeof(b=arguments[c]))throw new Error("missing callback");for(var d=Array(c),e=0;e<c;++e)d[e]=arguments[e];a.apply(this,d).then(function(a){return b(void 0,a)},function(a){return b(a)})},a.name,a.length+1)}},{"./_setFunctionNameAndLength":16}],55:[function(a,b){"use strict";b.exports=a("./Disposable").use},{"./Disposable":3}],56:[function(a,b){"use strict";var c=a("./_resolve");b.exports=function(a,b,d){try{return c(a.apply(d,b))}catch(a){return Promise.reject(a)}}},{"./_resolve":15}],57:[function(a,b){"use strict";var c=a("./_resolve");b.exports=function(a,b,d){try{return c(a.call(d,b))}catch(a){return Promise.reject(a)}}},{"./_resolve":15}]},{},[36])(36)}); | ||
(function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;b="undefined"==typeof window?"undefined"==typeof global?"undefined"==typeof self?this:self:global:window,b.promiseToolbox=a()}})(function(){return function(){function b(d,e,g){function a(j,i){if(!e[j]){if(!d[j]){var f="function"==typeof require&&require;if(!i&&f)return f(j,!0);if(h)return h(j,!0);var c=new Error("Cannot find module '"+j+"'");throw c.code="MODULE_NOT_FOUND",c}var k=e[j]={exports:{}};d[j][0].call(k.exports,function(b){var c=d[j][1][b];return a(c||b)},k,k.exports,b,d,e,g)}return e[j].exports}for(var h="function"==typeof require&&require,c=0;c<g.length;c++)a(g[c]);return a}return b}()({1:[function(a,b){"use strict";b.exports=function(){function a(a){void 0===a&&(a="this action has been canceled"),Object.defineProperty(this,"message",{enumerable:!0,value:a})}var b=a.prototype;return b.toString=function(){return`Cancel: ${this.message}`},a}()},{}],2:[function(a,b){"use strict";function c(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}function d(a,b,d){return b&&c(a.prototype,b),d&&c(a,d),a}function e(a){if(void 0===this._reason){var b=this._reason=a instanceof j?a:new j(a),c=this._resolve;void 0!==c&&(this._resolve=void 0,c(b));var d=this.onabort;"function"==typeof d&&d();var e=this._handlers;if(void 0!==e){this._handlers=void 0;for(var f=h(),g=f.promise,l=f.resolve,m=0,o=function(){if(0==--m)return l()},p=0,q=e.length;p<q;++p)try{var n=e[p](b);k(n)&&(++m,n.then(o,o))}catch(a){}if(0!==m)return g}}}function f(a){var b=this._handlers;if(b!==void 0){var c=b.indexOf(a);-1!==c&&b.splice(c,1)}}function g(a){var b=this.cancel=e.bind(this.token=new p(o));null==a||a.forEach(function(a){var c=a.reason;return void 0===c?void a.addHandler(b):(b(c),!1)})}var h=a("./defer"),j=a("./Cancel"),k=a("./isPromise"),l=a("./_symbols"),m=l.$$toStringTag,n="CancelToken",o={},p=function(){function a(a){this._handlers=void 0,this._promise=void 0,this._reason=void 0,this._resolve=void 0,this.onabort=void 0,a!==o&&a(e.bind(this))}a.from=function(b){if(a.isCancelToken(b))return b;var c=new a(o);return b.addEventListener("abort",e.bind(c)),c},a.isCancelToken=function(a){return null!=a&&a[m]===n},a.source=function(a){return new g(a)};var b=a.prototype;return b.addHandler=function(a){var b=this._handlers;if(void 0===b){if(this.requested)throw new TypeError("cannot add a handler to an already canceled token");b=this._handlers=[]}return b.push(a),f.bind(this,a)},b.throwIfRequested=function(){var a=this._reason;if(void 0!==a)throw a},b.addEventListener=function(a,b){"abort"!==a||("function"!=typeof b&&(b=b.handleEvent.bind(b)),this.addHandler(b))},b.removeEventListener=function(){},d(a,[{key:"promise",get:function(){var a=this,b=this._promise;if(void 0===b){var c=this._reason;b=this._promise=void 0===c?new Promise(function(b){a._resolve=b}):Promise.resolve(c)}return b}},{key:"reason",get:function(){return this._reason}},{key:"requested",get:function(){return void 0!==this._reason}},{key:m,get:function(){return n}},{key:"aborted",get:function(){return this.requested}}]),a}();e.call(p.canceled=new p(o)),p.none=new p(o),b.exports=p},{"./Cancel":1,"./_symbols":17,"./defer":23,"./isPromise":36}],3:[function(a,b){"use strict";function c(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}function d(a,b,d){return b&&c(a.prototype,b),d&&c(a,d),a}var e=a("./_evalDisposable"),f=a("./_isDisposable"),g=a("./_finally"),h=a("./_setFunctionNameAndLength"),i=a("./wrapApply"),j=a("./wrapCall"),k=function(){function a(a,b){if("function"!=typeof a)throw new Error("dispose must be a function");this._dispose=a,this._value=b}var b=a.prototype;return b.dispose=function(){if(void 0===this._dispose)throw new TypeError("this disposable has already been disposed");var a=this._dispose;return this._dispose=this._value=void 0,a()},d(a,[{key:"value",get:function(){if(void 0===this._dispose)throw new TypeError("this disposable has already been disposed");return this._value}}]),a}();b.exports=k,k.all=function(a){var b=[],c=function(){var a=b;b=void 0,a.forEach(function(a){return a.dispose()})},d=function(a){return void 0===b?f(a)&&a.dispose():f(a)?(b.push(a),a.value):a},g=function(a){if(void 0!==b)throw c(),a};return Promise.all(Array.from(a,function(a){return e(a).then(d,g)})).then(function(a){return new k(c,a)})};var l=a("./_ExitStack");k.factory=function(a){return h(function(){var b=a.apply(this,arguments),c=new l,d=c.dispose,g=c.value,h=function(a){return f(a)?m(g.enter(a)):a},i=function(a){var b=a.value;return e(b).then(h)},m=function(a){return j(b.next,a,b).then(i)};return m().then(function(a){return new k(function(){return j(b.return,void 0,b).then(d)},a)},function(a){var b=function(){throw a};return d().then(b,b)})},a.name,a.length)};var m=function(a){if(null==a||"function"!=typeof a.next)return a;var b=new l,c=b.dispose,d=b.value,f=function(a){return i(d.enter(a))},h=function(a){return a.done?a.value:e(a.value).then(f)},i=function(b){return j(a.next,b,a).then(h)};return g(i(),c)};k.use=function(){var a=this,b=arguments.length-1;if(0>b)throw new TypeError("Disposable.use expects at least 1 argument");var c,d=arguments[b],e=1<b||!Array.isArray(c=arguments[0]);return e?c=Array.prototype.slice.call(arguments,0,b):b=c.length,k.all(c).then(function(b){return g((e?i:j)(d,b.value,a).then(m),function(){return b.dispose()})})}},{"./_ExitStack":5,"./_evalDisposable":6,"./_finally":7,"./_isDisposable":9,"./_setFunctionNameAndLength":16,"./wrapApply":52,"./wrapCall":53}],4:[function(a,b){"use strict";function c(a,b){a.prototype=Object.create(b.prototype),a.prototype.constructor=a,d(a,b)}function d(a,b){return d=Object.setPrototypeOf||function(a,b){return a.__proto__=b,a},d(a,b)}var e=a("make-error"),f=e.BaseError;b.exports=function(a){function b(){return a.call(this,"operation timed out")||this}return c(b,a),b}(f)},{"make-error":38}],5:[function(a,b){"use strict";var c=a("./_isDisposable"),d=a("./_resolve");b.exports=function(){function a(){var a=this;this._disposables=[];return{dispose:function b(){var c=a._disposables.pop();return void 0===c?Promise.resolve():d(c.dispose()).then(b)},value:this}}var b=a.prototype;return b.enter=function(a){if(!c(a))throw new TypeError("not a disposable");return this._disposables.push(a),a.value},a}()},{"./_isDisposable":9,"./_resolve":15}],6:[function(a,b){"use strict";var c=a("./try");b.exports=function(a){return"function"==typeof a?c(a):Promise.resolve(a)}},{"./try":50}],7:[function(a,b){"use strict";b.exports=function(a,b){return a.then(b,b).then(function(){return a})}},{}],8:[function(a,b){"use strict";b.exports=function(a){return a}},{}],9:[function(a,b){"use strict";b.exports=function(a){return null!=a&&"function"==typeof a.dispose}},{}],10:[function(a,b){"use strict";b.exports=function(a){return a instanceof ReferenceError||a instanceof SyntaxError||a instanceof TypeError}},{}],11:[function(a,b){"use strict";var c=a("./_noop"),d=a("./_once");b.exports=function(a,b,e){var f=b.addEventListener||b.addListener||b.on;if(void 0===f)throw new Error("cannot register event listener");var g=b.removeEventListener||b.removeListener||b.off,h=[],i=c;return void 0!==g&&(i=d(function(){for(var a=0,c=h.length;a<c;a+=2)g.call(b,h[a],h[a+1])}),a.promise.then(i)),e?function(a,c){function d(){i();var b=Array.prototype.slice.call(arguments);b.args=b,b.event=b.name=a,c(b)}h.push(a,d),f.call(b,a,d)}:function(a,c){var d=function(a){i(),c(a)};h.push(a,d),f.call(b,a,d)}}},{"./_noop":13,"./_once":14}],12:[function(a,b){"use strict";var c=a("./_isProgrammerError");b.exports=function a(b,d){if(b===void 0)return!c(d);var e=typeof b;if("boolean"==e)return b;if("function"==e)return b===Error||b.prototype instanceof Error?d instanceof b:b(d);if(Array.isArray(b)){for(var f=b.length,g=0;g<f;++g)if(a(b[g],d))return!0;return!1}if(null!=d&&"object"===e){for(var h in b)if(hasOwnProperty.call(b,h)&&d[h]!==b[h])return!1;return!0}}},{"./_isProgrammerError":10}],13:[function(a,b){"use strict";b.exports=Function.prototype},{}],14:[function(a,b){"use strict";b.exports=function(a){var b;return function(){return void 0!==a&&(b=a.apply(this,arguments),a=void 0),b}}},{}],15:[function(a,b){"use strict";var c=a("./isPromise");b.exports=function(a){return c(a)?a:Promise.resolve(a)}},{"./isPromise":36}],16:[function(a,b){"use strict";b.exports=function(){var b=Object.defineProperties;try{var c=b(function(){},{length:{value:2},name:{value:"foo"}});if(2===c.length&&"foo"===c.name)return function(a,c,d){return b(a,{length:{configurable:!0,value:0<d?d:0},name:{configurable:!0,value:c}})}}catch(a){}return a("./_identity")}()},{"./_identity":8}],17:[function(a,b,c){"use strict";var d="function"==typeof Symbol?function(a){var b=Symbol[a];return b===void 0?`@@${a}`:b}:function(a){return`@@${a}`};c.$$iterator=d("iterator"),c.$$toStringTag=d("toStringTag")},{}],18:[function(a,b,c){"use strict";if("function"!=typeof Promise||"function"!=typeof Promise.reject||"function"!=typeof Promise.resolve)throw new Error("a standard Promise implementation is required (https://github.com/JsCommunity/promise-toolbox#usage)");var d=a("./isPromise"),e=a("./_symbols"),f=e.$$iterator,g=c.forArray=function(a,b){for(var c=a.length,d=0;d<c;++d)b(a[d],d,a)};c.forIn=function(a,b){for(var c in a)b(a[c],c,a)};var h=c.forIterable=function(a,b){for(var c,d=a[f]();!(c=d.next()).done;)b(c.value,void 0,a)},i=Object.prototype.hasOwnProperty,j=c.forOwn=function(a,b){for(var c in a)i.call(a,c)&&b(a[c],c,a)},k=function(a){return null!=a&&"function"==typeof a[f]},l=c.forEach=function(a,b){return Array.isArray(a)?g(a,b):k(a)?h(a,b):n(a)?g(a,b):j(a,b)},m=function(a){return"number"==typeof a&&0<=a&&a<1/0&&Math.floor(a)===a},n=c.isArrayLike=function(a){return"function"!=typeof a&&null!=a&&m(a.length)};c.makeAsyncIterator=function(a){return function b(c,e){if(d(c))return c.then(function(a){return b(a,e)});var f=Promise.resolve();return a(c,function(a,b){f=d(a)?f.then(function(){return a.then(function(a){return e(a,b,c)})}):f.then(function(){return e(a,b,c)})}),f}},c.map=function(a,b){var c=[];return l(a,function(a,d,e){c.push(b(a,d,e))}),c},c.mapAuto=function(a,b){var c=n(a)?Array(a.length):Object.create(null);return void 0!==b&&l(a,function(a,d,e){c[d]=b(a,d,e)}),c}},{"./_symbols":17,"./isPromise":36}],19:[function(a,b){"use strict";b.exports=function(a){return"function"==typeof a&&this.then(function(b){return a(void 0,b)},a),this}},{}],20:[function(a,b){"use strict";function c(a,b){var c;try{c=this._iterator[a](b)}catch(a){return this.finally(),this._reject(a)}b=c.value,c.done?(this.finally(),this._resolve(b)):this.toPromise(b).then(this.next,this._throw)}function d(a,b,d){this._iterator=a,this._reject=d,this._resolve=b,this._throw=c.bind(this,"throw"),this.next=c.bind(this,"next")}function e(a){var b=this;d.apply(this,[].slice.call(arguments,1)),this._cancelToken=a,this._onCancel=i,this.finally=a.addHandler(function(a){return b._onCancel(a),new Promise(function(a){b.finally=a})})}var f=a("./_identity"),g=a("./isPromise"),h=a("./_resolve"),i=Function.prototype;d.prototype.finally=i,d.prototype.toPromise=h;var j=function(a){return function(){var b=arguments,c=this;return new Promise(function(e,f){return new d(a.apply(c,b),e,f).next()})}};Object.setPrototypeOf(e.prototype,Object.getPrototypeOf(d.prototype)).toPromise=function(a){var b=this;if(Array.isArray(a))return h(a[0]);var c=this._cancelToken;return c.requested?Promise.reject(c.reason):g(a)?new Promise(function(c,d){a.then(c,d),b._onCancel=d}):Promise.resolve(a)},j.cancelable=function(a,b){return void 0===b&&(b=f),function(){var c=arguments,d=this,f=b.apply(this,arguments);return f.requested?Promise.reject(f.reason):new Promise(function(b,g){new e(f,a.apply(d,c),b,g).next()})}},b.exports=j},{"./_identity":8,"./_resolve":15,"./isPromise":36}],21:[function(a,b){"use strict";var c=a("./_setFunctionNameAndLength"),d=a("./CancelToken"),e=d.isCancelToken,f=d.source;b.exports=function(a,b,d){var g=d===void 0?a:d.value,h=c(function(){var a=arguments.length;if(0!==a&&e(arguments[0]))return g.apply(this,arguments);var b=f(),c=b.cancel,d=b.token,h=Array(a+1);h[0]=d;for(var j=0;j<a;++j)h[j+1]=arguments[j];var k=g.apply(this,h);return k.cancel=c,k},g.name,g.length-1);return void 0===d?h:(d.value=h,d)}},{"./CancelToken":2,"./_setFunctionNameAndLength":16}],22:[function(a,b){"use strict";function c(a,b,c){return d(a,c)?b(c):this}var d=a("./_matchError");b.exports=function(){var a,b=arguments.length;return 0===b||"function"!=typeof(a=arguments[--b])?this:this.then(void 0,c.bind(this,0===b?void 0:1===b?arguments[0]:Array.prototype.slice.call(arguments,0,b),a))}},{"./_matchError":12}],23:[function(a,b){"use strict";b.exports=function(){var a,b,c=new Promise(function(c,d){a=c,b=d});return{promise:c,reject:b,resolve:a}}},{}],24:[function(a,b){"use strict";var c=a("./isPromise");b.exports=function(a){var b=2===arguments.length?arguments[1]:this;if(c(b))return b.then(function(b){return new Promise(function(c){setTimeout(c,a,b)})});var d,e=new Promise(function(c){d=setTimeout(c,a,b)});return e.unref=function(){return null!=d&&"function"==typeof d.unref&&d.unref(),e},e}},{"./isPromise":36}],25:[function(a,b){"use strict";b.exports=function(a){var b=this;return this.then(a,a).then(function(){return b})}},{}],26:[function(a,b){"use strict";b.exports=a("./makeAsyncIterator")(a("./_utils").forArray)},{"./_utils":18,"./makeAsyncIterator":37}],27:[function(a,b){"use strict";b.exports=a("./makeAsyncIterator")(a("./_utils").forEach)},{"./_utils":18,"./makeAsyncIterator":37}],28:[function(a,b){"use strict";b.exports=a("./makeAsyncIterator")(a("./_utils").forIn)},{"./_utils":18,"./makeAsyncIterator":37}],29:[function(a,b){"use strict";b.exports=a("./makeAsyncIterator")(a("./_utils").forIterable)},{"./_utils":18,"./makeAsyncIterator":37}],30:[function(a,b){"use strict";b.exports=a("./makeAsyncIterator")(a("./_utils").forOwn)},{"./_utils":18,"./makeAsyncIterator":37}],31:[function(a,b){"use strict";function c(a,b,c,d){b.push(function(a,b){return null!=a&&!1!==a?d(a):c(b)}),a.apply(this,b)}b.exports=function(a){for(var b=arguments.length,d=Array(1<b?b-1:0),e=1;e<b;e++)d[e-1]=arguments[e];return new Promise(c.bind(this,"function"==typeof a?a:this[a],d))}},{}],32:[function(a,b){"use strict";var c=a("./cancelable"),d=a("./_makeEventAdder"),e=c(function(a,b,c,e){return void 0===e&&(e={}),new Promise(function(f,g){var h=d(a,b,e.array);if(h(c,f),!e.ignoreErrors){var i=e,j=i.error,k=void 0===j?"error":j;k!==c&&h(k,g)}})});b.exports=e},{"./_makeEventAdder":11,"./cancelable":21}],33:[function(a,b){"use strict";var c=a("./cancelable"),d=a("./_makeEventAdder"),e=a("./_utils"),f=e.forArray,g=c(function(a,b,c,e){return void 0===e&&(e=["error"]),new Promise(function(g,h){var i=d(a,b,!0);f(c,function(a){return i(a,g)}),f(e,function(a){return i(a,h)})})});b.exports=g},{"./_makeEventAdder":11,"./_utils":18,"./cancelable":21}],34:[function(a,b){"use strict";var c=a("./_isProgrammerError"),d=function(a){if(c(a))throw a};b.exports=function(){return this.then(void 0,d)}},{"./_isProgrammerError":10}],35:[function(a,b,c){"use strict";c.pAsCallback=c.asCallback=a("./asCallback"),c.pAsyncFn=c.asyncFn=a("./asyncFn"),c.pCancel=c.Cancel=a("./Cancel"),c.pCancelable=c.cancelable=a("./cancelable"),c.pCancelToken=c.CancelToken=a("./CancelToken"),c.pCatch=c.catch=a("./catch"),c.pDefer=c.defer=a("./defer"),c.pDelay=c.delay=a("./delay"),c.pDisposable=c.Disposable=a("./Disposable"),c.pFinally=c.finally=a("./finally"),c.pForArray=c.forArray=a("./forArray"),c.pForEach=c.forEach=a("./forEach"),c.pForIn=c.forIn=a("./forIn"),c.pForIterable=c.forIterable=a("./forIterable"),c.pForOwn=c.forOwn=a("./forOwn"),c.pFromCallback=c.fromCallback=a("./fromCallback"),c.pFromEvent=c.fromEvent=a("./fromEvent"),c.pFromEvents=c.fromEvents=a("./fromEvents"),c.pIgnoreErrors=c.ignoreErrors=a("./ignoreErrors"),c.pIsPromise=c.isPromise=a("./isPromise"),c.pMakeAsyncIterator=c.makeAsyncIterator=a("./makeAsyncIterator"),c.pNodeify=c.nodeify=a("./nodeify"),c.pPipe=c.pipe=a("./pipe"),c.pPromisify=c.promisify=a("./promisify"),c.pPromisifyAll=c.promisifyAll=a("./promisifyAll"),c.pReflect=c.reflect=a("./reflect"),c.pRetry=c.retry=a("./retry"),c.pSome=c.some=a("./some"),c.pSuppressUnhandledRejections=c.suppressUnhandledRejections=a("./suppressUnhandledRejections"),c.pTap=c.tap=a("./tap"),c.pTapCatch=c.tapCatch=a("./tapCatch"),c.pTimeout=c.timeout=a("./timeout"),c.pTimeoutError=c.TimeoutError=a("./TimeoutError"),c.pTry=c.try=a("./try"),c.pUnpromisify=c.unpromisify=a("./unpromisify"),c.pWrapApply=c.wrapApply=a("./wrapApply"),c.pWrapCall=c.wrapCall=a("./wrapCall")},{"./Cancel":1,"./CancelToken":2,"./Disposable":3,"./TimeoutError":4,"./asCallback":19,"./asyncFn":20,"./cancelable":21,"./catch":22,"./defer":23,"./delay":24,"./finally":25,"./forArray":26,"./forEach":27,"./forIn":28,"./forIterable":29,"./forOwn":30,"./fromCallback":31,"./fromEvent":32,"./fromEvents":33,"./ignoreErrors":34,"./isPromise":36,"./makeAsyncIterator":37,"./nodeify":39,"./pipe":40,"./promisify":41,"./promisifyAll":42,"./reflect":43,"./retry":44,"./some":45,"./suppressUnhandledRejections":46,"./tap":47,"./tapCatch":48,"./timeout":49,"./try":50,"./unpromisify":51,"./wrapApply":52,"./wrapCall":53}],36:[function(a,b){"use strict";b.exports=function(a){return null!=a&&"function"==typeof a.then}},{}],37:[function(a,b){"use strict";var c=a("./_noop"),d=a("./_utils"),e=d.makeAsyncIterator;b.exports=function(a){var b=e(a);return function(a){return b(this,a).then(c)}}},{"./_noop":13,"./_utils":18}],38:[function(a,b,c){"use strict";function d(a){a!==void 0&&f(this,"message",{configurable:!0,value:a,writable:!0});var b=this.constructor.name;b!==void 0&&b!==this.name&&f(this,"name",{configurable:!0,value:b,writable:!0}),g(this,this.constructor)}var e="undefined"==typeof Reflect?void 0:Reflect.construct,f=Object.defineProperty,g=Error.captureStackTrace;g===void 0&&(g=function(a){var b=new Error;f(a,"stack",{configurable:!0,get:function(){var a=b.stack;return f(this,"stack",{configurable:!0,value:a,writable:!0}),a},set:function(b){f(a,"stack",{configurable:!0,value:b,writable:!0})}})}),d.prototype=Object.create(Error.prototype,{constructor:{configurable:!0,value:d,writable:!0}});var h=function(){function a(a,b){return f(a,"name",{configurable:!0,value:b})}try{var b=function(){};if(a(b,"foo"),"foo"===b.name)return a}catch(a){}}();c=b.exports=function(a,b){if(null==b||b===Error)b=d;else if("function"!=typeof b)throw new TypeError("super_ should be a function");var c;if("string"==typeof a)c=a,a=void 0===e?function(){b.apply(this,arguments)}:function(){return e(b,arguments,this.constructor)},void 0!==h&&(h(a,c),c=void 0);else if("function"!=typeof a)throw new TypeError("constructor should be either a string or a function");a.super_=a["super"]=b;var f={constructor:{configurable:!0,value:a,writable:!0}};return void 0!==c&&(f.name={configurable:!0,value:c,writable:!0}),a.prototype=Object.create(b.prototype,f),a},c.BaseError=d},{}],39:[function(a,b){"use strict";var c=a("./_setFunctionNameAndLength"),d=a("./wrapApply"),e=Array.prototype.slice;b.exports=function(a){return c(function(){var b,c=arguments.length-1;if(0>c||"function"!=typeof(b=arguments[c]))throw new TypeError("missing callback");var f=e.call(arguments,0,c);d(a,f).then(function(a){return b(void 0,a)},b)},a.name,a.length+1)}},{"./_setFunctionNameAndLength":16,"./wrapApply":52}],40:[function(a,b){"use strict";var c=Array.isArray,d=Array.prototype.slice,e=function(a,b){return a.then(b)};b.exports=function(a){return c(a)||(a=d.call(arguments)),"function"==typeof a[0]?function(b){return a.reduce(e,Promise.resolve(b))}:(a[0]=Promise.resolve(a[0]),a.reduce(e))}},{}],41:[function(a,b){"use strict";var c=a("./_setFunctionNameAndLength");b.exports=function(a,b){return c(function(){for(var c=this,d=arguments.length,e=Array(d+1),f=0;f<d;++f)e[f]=arguments[f];return new Promise(function(f,g){e[d]=function(a,b){return null!=a&&!1!==a?g(a):f(b)},a.apply(b===void 0?c:b,e)})},a.name,a.length-1)}},{"./_setFunctionNameAndLength":16}],42:[function(a,b){"use strict";var c=a("./promisify"),d=a("./_utils"),e=d.forIn,f=function(a,b){return!(b.endsWith("Sync")||b.endsWith("Async"))&&b};b.exports=function(a,b){var d=void 0===b?{}:b,g=d.mapper,h=void 0===g?f:g,i=d.target,j=void 0===i?{}:i,k=d.context,l=void 0===k?a:k;return e(a,function(b,d){var e;"function"==typeof b&&(e=h(b,d,a))&&(j[e]=c(b,l))}),j}},{"./_utils":18,"./promisify":41}],43:[function(a,b){"use strict";var c=function(){return!1},d=function(){return!0},e=function(a){return function(b){return{__proto__:a,value:function(){return b}}}}({isFulfilled:d,isPending:c,isRejected:c,reason:function(){throw new Error("no reason, the promise has resolved")}}),f=function(a){return function(b){return{__proto__:a,reason:function(){return b}}}}({isFulfilled:c,isPending:c,isRejected:d,value:function(){throw new Error("no value, the promise has rejected")}});b.exports=function(){return this.then(e,f)}},{}],44:[function(a,b){"use strict";function c(a,b,c){var g,h=this,i=void 0===b?{}:b,j=i.delay,k=i.delays,l=i.onRetry,m=void 0===l?f:l,n=i.retries,o=i.tries,p=i.when;if(k!==void 0){if(j!==void 0||o!==void 0||n!==void 0)throw new TypeError("delays is incompatible with delay, tries and retries");var q=k[Symbol.iterator]();g=function(){var a=q.next(),b=a.done,c=a.value;return!b&&(j=c,!0)}}else{if(o===void 0)o=void 0===n?10:n+1;else if(n!==void 0)throw new TypeError("retries and tries options are mutually exclusive");j===void 0&&(j=1e3),g=function(){return 0!=--o}}p=e.bind(void 0,p);var r=0,s=function(a){return setTimeout(a,j)},t=function(){return new Promise(s)},u=function(b){if(b instanceof d)throw b.error;if(p(b)&&g()){var e=Promise.resolve(m.call({arguments:c,attemptNumber:r++,delay:j,fn:a,this:h},b));return 0!==j&&(e=e.then(t)),e.then(w)}throw b},v=function(b){return b(a.apply(h,c))},w=function(){return new Promise(v).catch(u)};return w()}function d(a){this.error=a}var e=a("./_matchError"),f=a("./_noop"),g=a("./_setFunctionNameAndLength");b.exports=c,c.bail=function(a){throw new d(a)},c.wrap=function(a,b){var d="function"==typeof b?b:function(){return b};return g(function(){return c.call(this,a,d.apply(this,arguments),Array.from(arguments))},a.name,a.length)}},{"./_matchError":12,"./_noop":13,"./_setFunctionNameAndLength":16}],45:[function(a,b){"use strict";var c=a("./_resolve"),d=a("./_utils"),e=d.forEach,f=function(a,b){return new Promise(function(c,d){var f=[],g=[],h=function(a){f&&(f.push(a),0==--b&&(c(f),f=g=void 0))},i=-b,j=function(a){f&&(g.push(a),0==--i&&(d(g),f=g=void 0))};e(a,function(a){++i,c(a).then(h,j)})})};b.exports=function(a){return c(this).then(function(b){return f(b,a)})}},{"./_resolve":15,"./_utils":18}],46:[function(a,b){"use strict";var c=a("./_noop");b.exports=function(){var a=this.suppressUnhandledRejections;return"function"==typeof a?a.call(this):this.then(void 0,c),this}},{"./_noop":13}],47:[function(a,b){"use strict";b.exports=function(a,b){var c=this;return this.then(a,b).then(function(){return c})}},{}],48:[function(a,b){"use strict";b.exports=function(a){var b=this;return this.then(void 0,a).then(function(){return b})}},{}],49:[function(a,b){"use strict";var c=a("./TimeoutError");b.exports=function(a,b){var d=this;return 0===a?this:(void 0===b&&(b=new c),new Promise(function(c,e){var f=setTimeout(function(){if(f=void 0,"function"==typeof d.cancel&&d.cancel(),"function"==typeof b)try{c(b())}catch(a){e(a)}else e(b)},a);d.then(function(a){void 0!==f&&clearTimeout(f),c(a)},function(a){void 0!==f&&clearTimeout(f),e(a)})}))}},{"./TimeoutError":4}],50:[function(a,b){"use strict";var c=a("./_resolve");b.exports=function(a){try{return c(a())}catch(a){return Promise.reject(a)}}},{"./_resolve":15}],51:[function(a,b){"use strict";var c=a("./_setFunctionNameAndLength");b.exports=function(){var a=this;return c(function(){var b,c=arguments.length-1;if(0>c||"function"!=typeof(b=arguments[c]))throw new Error("missing callback");for(var d=Array(c),e=0;e<c;++e)d[e]=arguments[e];a.apply(this,d).then(function(a){return b(void 0,a)},function(a){return b(a)})},a.name,a.length+1)}},{"./_setFunctionNameAndLength":16}],52:[function(a,b){"use strict";var c=a("./_resolve");b.exports=function(a,b,d){try{return c(a.apply(d,b))}catch(a){return Promise.reject(a)}}},{"./_resolve":15}],53:[function(a,b){"use strict";var c=a("./_resolve");b.exports=function(a,b,d){try{return c(a.call(d,b))}catch(a){return Promise.reject(a)}}},{"./_resolve":15}]},{},[35])(35)}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
97965
1087
59
1301