Socket
Socket
Sign inDemoInstall

rsvp

Package Overview
Dependencies
Maintainers
6
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rsvp - npm Package Compare versions

Comparing version 3.6.2 to 4.0.0

2

dist/rsvp.min.js

@@ -1,1 +0,1 @@

(function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.RSVP=t.RSVP||{})})(this,function(t){"use strict";function e(t,e){for(var r=0,n=t.length;r<n;r++)if(t[r]===e)return r;return-1}function r(t){var e=t._promiseCallbacks;e||(e=t._promiseCallbacks={});return e}function n(t,e){if(2!==arguments.length)return jt[t];jt[t]=e}function o(t){var e=typeof t;return null!==t&&("object"===e||"function"===e)}function i(t){return"function"==typeof t}function u(t){return null!==t&&"object"==typeof t}function a(t){return null!==t&&"object"==typeof t}function s(){setTimeout(function(){for(var t=0;t<St.length;t++){var e=St[t],r=e.payload;r.guid=r.key+r.id;r.childGuid=r.key+r.childId;r.error&&(r.stack=r.error.stack);jt.trigger(e.name,e.payload)}St.length=0},50)}function c(t,e,r){1===St.push({name:t,payload:{key:e._guidKey,id:e._id,eventName:t,detail:e._result,childId:r&&r._id,label:e._label,timeStamp:Ot(),error:jt["instrument-with-stack"]?new Error(e._label):null}})&&s()}function f(t,e){var r=this;if(t&&"object"==typeof t&&t.constructor===r)return t;var n=new r(h,e);m(n,t);return n}function l(){return new TypeError("A promises callback cannot return that same promise.")}function h(){}function p(t){try{return t.then}catch(e){kt.error=e;return kt}}function y(t,e,r,n){try{t.call(e,r,n)}catch(o){return o}}function v(t,e,r){jt.async(function(t){var n=!1,o=y(r,e,function(r){if(!n){n=!0;e!==r?m(t,r,void 0):b(t,r)}},function(e){if(!n){n=!0;g(t,e)}},"Settle: "+(t._label||" unknown promise"));if(!n&&o){n=!0;g(t,o)}},t)}function d(t,e){if(e._state===Pt)b(t,e._result);else if(e._state===Rt){e._onError=null;g(t,e._result)}else j(e,void 0,function(r){e!==r?m(t,r,void 0):b(t,r)},function(e){return g(t,e)})}function _(t,e,r){var n=e.constructor===t.constructor&&r===P&&t.constructor.resolve===f;if(n)d(t,e);else if(r===kt){g(t,kt.error);kt.error=null}else i(r)?v(t,e,r):b(t,e)}function m(t,e){t===e?b(t,e):o(e)?_(t,e,p(e)):b(t,e)}function w(t){t._onError&&t._onError(t._result);E(t)}function b(t,e){if(t._state===At){t._result=e;t._state=Pt;0===t._subscribers.length?jt.instrument&&c("fulfilled",t):jt.async(E,t)}}function g(t,e){if(t._state===At){t._state=Rt;t._result=e;jt.async(w,t)}}function j(t,e,r,n){var o=t._subscribers,i=o.length;t._onError=null;o[i]=e;o[i+Pt]=r;o[i+Rt]=n;0===i&&t._state&&jt.async(E,t)}function E(t){var e=t._subscribers,r=t._state;jt.instrument&&c(r===Pt?"fulfilled":"rejected",t);if(0!==e.length){for(var n=void 0,o=void 0,i=t._result,u=0;u<e.length;u+=3){n=e[u];o=e[u+r];n?S(r,n,o,i):o(i)}t._subscribers.length=0}}function T(){this.error=null}function O(t,e){try{return t(e)}catch(r){xt.error=r;return xt}}function S(t,e,r,n){var o=i(r),u=void 0,a=void 0;if(o){u=O(r,n);if(u===xt){a=u.error;u.error=null}else if(u===e){g(e,l());return}}else u=n;e._state!==At||(o&&void 0===a?m(e,u):void 0!==a?g(e,a):t===Pt?b(e,u):t===Rt&&g(e,u))}function A(t,e){var r=!1;try{e(function(e){if(!r){r=!0;m(t,e)}},function(e){if(!r){r=!0;g(t,e)}})}catch(n){g(t,n)}}function P(t,e,r){var n=this,o=n._state;if(o===Pt&&!t||o===Rt&&!e){jt.instrument&&c("chained",n,n);return n}n._onError=null;var i=new n.constructor(h,r),u=n._result;jt.instrument&&c("chained",n,i);if(o===At)j(n,i,t,e);else{var a=o===Pt?t:e;jt.async(function(){return S(o,i,a,u)})}return i}function R(t,e,r){return t===Pt?{state:"fulfilled",value:r}:{state:"rejected",reason:r}}function k(t,e){return Tt(t)?new Mt(this,t,(!0),e).promise:this.reject(new TypeError("Promise.all must be called with an array"),e)}function x(t,e){var r=this,n=new r(h,e);if(!Tt(t)){g(n,new TypeError("Promise.race must be called with an array"));return n}for(var o=0;n._state===At&&o<t.length;o++)j(r.resolve(t[o]),void 0,function(t){return m(n,t)},function(t){return g(n,t)});return n}function M(t,e){var r=this,n=new r(h,e);g(n,t);return n}function C(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function I(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function N(){this.value=void 0}function V(t){try{return t.then}catch(e){Vt.value=e;return Vt}}function D(t,e,r){try{t.apply(e,r)}catch(n){Vt.value=n;return Vt}}function K(t,e){for(var r={},n=t.length,o=new Array(n),i=0;i<n;i++)o[i]=t[i];for(var u=0;u<e.length;u++){var a=e[u];r[a]=o[u+1]}return r}function U(t){for(var e=t.length,r=new Array(e-1),n=1;n<e;n++)r[n-1]=t[n];return r}function q(t,e){return{then:function(r,n){return t.call(e,r,n)}}}function F(t,e){var r=function(){for(var r=this,n=arguments.length,o=new Array(n+1),i=!1,u=0;u<n;++u){var a=arguments[u];if(!i){i=W(a);if(i===Dt){var s=new Nt(h);g(s,Dt.value);return s}i&&i!==!0&&(a=q(i,a))}o[u]=a}var c=new Nt(h);o[n]=function(t,r){t?g(c,t):void 0===e?m(c,r):e===!0?m(c,U(arguments)):Tt(e)?m(c,K(arguments,e)):m(c,r)};return i?L(c,o,t,r):G(c,o,t,r)};r.__proto__=t;return r}function G(t,e,r,n){var o=D(r,n,e);o===Vt&&g(t,o.value);return t}function L(t,e,r,n){return Nt.all(e).then(function(e){var o=D(r,n,e);o===Vt&&g(t,o.value);return t})}function W(t){return!(!t||"object"!=typeof t)&&(t.constructor===Nt||V(t))}function Y(t,e){return Nt.all(t,e)}function $(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function z(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}});e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function B(t,e){return Tt(t)?new Kt(Nt,t,e).promise:Nt.reject(new TypeError("Promise.allSettled must be called with an array"),e)}function H(t,e){return Nt.race(t,e)}function J(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function Q(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}});e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function X(t,e){return u(t)?new qt(Nt,t,e).promise:Nt.reject(new TypeError("Promise.hash must be called with an object"),e)}function Z(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function tt(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}});e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function et(t,e){return u(t)?new Ft(Nt,t,(!1),e).promise:Nt.reject(new TypeError("RSVP.hashSettled must be called with an object"),e)}function rt(t){setTimeout(function(){throw t});throw t}function nt(t){var e={resolve:void 0,reject:void 0};e.promise=new Nt(function(t,r){e.resolve=t;e.reject=r},t);return e}function ot(t,e,r){return Tt(t)?i(e)?Nt.all(t,r).then(function(t){for(var n=t.length,o=new Array(n),i=0;i<n;i++)o[i]=e(t[i]);return Nt.all(o,r)}):Nt.reject(new TypeError("RSVP.map expects a function as a second argument"),r):Nt.reject(new TypeError("RSVP.map must be called with an array"),r)}function it(t,e){return Nt.resolve(t,e)}function ut(t,e){return Nt.reject(t,e)}function at(t,e){return Nt.all(t,e)}function st(t,e){return Nt.resolve(t,e).then(function(t){return at(t,e)})}function ct(t,e,r){if(!(Tt(t)||u(t)&&void 0!==t.then))return Nt.reject(new TypeError("RSVP.filter must be called with an array or promise"),r);if(!i(e))return Nt.reject(new TypeError("RSVP.filter expects function as a second argument"),r);var n=Tt(t)?at(t,r):st(t,r);return n.then(function(t){for(var n=t.length,o=new Array(n),i=0;i<n;i++)o[i]=e(t[i]);return at(o,r).then(function(e){for(var r=new Array(n),o=0,i=0;i<n;i++)if(e[i]){r[o]=t[i];o++}r.length=o;return r})})}function ft(t,e){Ht[Gt]=t;Ht[Gt+1]=e;Gt+=2;2===Gt&&Jt()}function lt(){var t=process.nextTick,e=process.versions.node.match(/^(?:(\d+)\.)?(?:(\d+)\.)?(\*|\d+)$/);Array.isArray(e)&&"0"===e[1]&&"10"===e[2]&&(t=setImmediate);return function(){return t(dt)}}function ht(){return"undefined"!=typeof Lt?function(){Lt(dt)}:vt()}function pt(){var t=0,e=new $t(dt),r=document.createTextNode("");e.observe(r,{characterData:!0});return function(){return r.data=t=++t%2}}function yt(){var t=new MessageChannel;t.port1.onmessage=dt;return function(){return t.port2.postMessage(0)}}function vt(){return function(){return setTimeout(dt,1)}}function dt(){for(var t=0;t<Gt;t+=2){var e=Ht[t],r=Ht[t+1];e(r);Ht[t]=void 0;Ht[t+1]=void 0}Gt=0}function _t(){try{var t=require,e=t("vertx");Lt=e.runOnLoop||e.runOnContext;return ht()}catch(r){return vt()}}function mt(t,e,r){e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r;return t}function wt(){jt.on.apply(jt,arguments)}function bt(){jt.off.apply(jt,arguments)}var gt={mixin:function(t){t.on=this.on;t.off=this.off;t.trigger=this.trigger;t._promiseCallbacks=void 0;return t},on:function(t,n){if("function"!=typeof n)throw new TypeError("Callback must be a function");var o=r(this),i=void 0;i=o[t];i||(i=o[t]=[]);e(i,n)===-1&&i.push(n)},off:function(t,n){var o=r(this),i=void 0,u=void 0;if(n){i=o[t];u=e(i,n);u!==-1&&i.splice(u,1)}else o[t]=[]},trigger:function(t,e,n){var o=r(this),i=void 0,u=void 0;if(i=o[t])for(var a=0;a<i.length;a++){u=i[a];u(e,n)}}},jt={instrument:!1};gt.mixin(jt);var Et=void 0;Et=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)};var Tt=Et,Ot=Date.now||function(){return(new Date).getTime()},St=[],At=void 0,Pt=1,Rt=2,kt=new T,xt=new T,Mt=function(){function t(t,e,r,n){this._instanceConstructor=t;this.promise=new t(h,n);this._abortOnReject=r;this._init.apply(this,arguments)}t.prototype._init=function(t,e){var r=e.length||0;this.length=r;this._remaining=r;this._result=new Array(r);this._enumerate(e);0===this._remaining&&b(this.promise,this._result)};t.prototype._enumerate=function(t){for(var e=this.length,r=this.promise,n=0;r._state===At&&n<e;n++)this._eachEntry(t[n],n)};t.prototype._settleMaybeThenable=function(t,e){var r=this._instanceConstructor,n=r.resolve;if(n===f){var o=p(t);if(o===P&&t._state!==At){t._onError=null;this._settledAt(t._state,e,t._result)}else if("function"!=typeof o){this._remaining--;this._result[e]=this._makeResult(Pt,e,t)}else if(r===Nt){var i=new r(h);_(i,t,o);this._willSettleAt(i,e)}else this._willSettleAt(new r(function(e){return e(t)}),e)}else this._willSettleAt(n(t),e)};t.prototype._eachEntry=function(t,e){if(a(t))this._settleMaybeThenable(t,e);else{this._remaining--;this._result[e]=this._makeResult(Pt,e,t)}};t.prototype._settledAt=function(t,e,r){var n=this.promise;if(n._state===At)if(this._abortOnReject&&t===Rt)g(n,r);else{this._remaining--;this._result[e]=this._makeResult(t,e,r);0===this._remaining&&b(n,this._result)}};t.prototype._makeResult=function(t,e,r){return r};t.prototype._willSettleAt=function(t,e){var r=this;j(t,void 0,function(t){return r._settledAt(Pt,e,t)},function(t){return r._settledAt(Rt,e,t)})};return t}(),Ct="rsvp_"+Ot()+"-",It=0,Nt=function(){function t(e,r){this._id=It++;this._label=r;this._state=void 0;this._result=void 0;this._subscribers=[];jt.instrument&&c("created",this);if(h!==e){"function"!=typeof e&&C();this instanceof t?A(this,e):I()}}t.prototype._onError=function(t){var e=this;jt.after(function(){e._onError&&jt.trigger("error",t,e._label)})};t.prototype["catch"]=function(t,e){return this.then(void 0,t,e)};t.prototype["finally"]=function(t,e){var r=this,n=r.constructor;return r.then(function(e){return n.resolve(t()).then(function(){return e})},function(e){return n.resolve(t()).then(function(){throw e})},e)};return t}();Nt.cast=f;Nt.all=k;Nt.race=x;Nt.resolve=f;Nt.reject=M;Nt.prototype._guidKey=Ct;Nt.prototype.then=P;var Vt=new N,Dt=new N,Kt=function(t){function e(e,r,n){return $(this,t.call(this,e,r,!1,n))}z(e,t);return e}(Mt);Kt.prototype._makeResult=R;var Ut=Object.prototype.hasOwnProperty,qt=function(t){function e(e,r){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],o=arguments[3];return J(this,t.call(this,e,r,n,o))}Q(e,t);e.prototype._init=function(t,e){this._result={};this._enumerate(e);0===this._remaining&&b(this.promise,this._result)};e.prototype._enumerate=function(t){var e=this.promise,r=[];for(var n in t)Ut.call(t,n)&&r.push({position:n,entry:t[n]});var o=r.length;this._remaining=o;for(var i=void 0,u=0;e._state===At&&u<o;u++){i=r[u];this._eachEntry(i.entry,i.position)}};return e}(Mt),Ft=function(t){function e(e,r,n){return Z(this,t.call(this,e,r,!1,n))}tt(e,t);return e}(qt);Ft.prototype._makeResult=R;var Gt=0,Lt=void 0,Wt="undefined"!=typeof window?window:void 0,Yt=Wt||{},$t=Yt.MutationObserver||Yt.WebKitMutationObserver,zt="undefined"==typeof self&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process),Bt="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,Ht=new Array(1e3),Jt=void 0;Jt=zt?lt():$t?pt():Bt?yt():void 0===Wt&&"function"==typeof require?_t():vt();var Qt=void 0;if("object"==typeof self)Qt=self;else{if("object"!=typeof global)throw new Error("no global: `self` or `global` found");Qt=global}var Xt;jt.async=ft;jt.after=function(t){return setTimeout(t,0)};var Zt=it,te=function(t,e){return jt.async(t,e)};if("undefined"!=typeof window&&"object"==typeof window.__PROMISE_INSTRUMENTATION__){var ee=window.__PROMISE_INSTRUMENTATION__;n("instrument",!0);for(var re in ee)ee.hasOwnProperty(re)&&wt(re,ee[re])}var ne=(Xt={asap:ft,cast:Zt,Promise:Nt,EventTarget:gt,all:Y,allSettled:B,race:H,hash:X,hashSettled:et,rethrow:rt,defer:nt,denodeify:F,configure:n,on:wt,off:bt,resolve:it,reject:ut,map:ot},mt(Xt,"async",te),mt(Xt,"filter",ct),Xt);t["default"]=ne;t.asap=ft;t.cast=Zt;t.Promise=Nt;t.EventTarget=gt;t.all=Y;t.allSettled=B;t.race=H;t.hash=X;t.hashSettled=et;t.rethrow=rt;t.defer=nt;t.denodeify=F;t.configure=n;t.on=wt;t.off=bt;t.resolve=it;t.reject=ut;t.map=ot;t.async=te;t.filter=ct;Object.defineProperty(t,"__esModule",{value:!0})});
(function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.RSVP=t.RSVP||{})})(this,function(t){"use strict";function e(t){var e=t._promiseCallbacks;e||(e=t._promiseCallbacks={});return e}function r(t,e){if(2!==arguments.length)return Ot[t];Ot[t]=e}function n(t){var e=typeof t;return null!==t&&("object"===e||"function"===e)}function o(t){return"function"==typeof t}function i(t){return null!==t&&"object"==typeof t}function u(t){return null!==t&&"object"==typeof t}function s(){setTimeout(function(){for(var t=0;t<At.length;t++){var e=At[t],r=e.payload;r.guid=r.key+r.id;r.childGuid=r.key+r.childId;r.error&&(r.stack=r.error.stack);Ot.trigger(e.name,e.payload)}At.length=0},50)}function c(t,e,r){1===At.push({name:t,payload:{key:e._guidKey,id:e._id,eventName:t,detail:e._result,childId:r&&r._id,label:e._label,timeStamp:Date.now(),error:Ot["instrument-with-stack"]?new Error(e._label):null}})&&s()}function a(t,e){var r=this;if(t&&"object"==typeof t&&t.constructor===r)return t;var n=new r(l,e);w(n,t);return n}function f(){return new TypeError("A promises callback cannot return that same promise.")}function l(){}function h(){this.error=null}function p(t){try{return t.then}catch(e){Rt.error=e;return Rt}}function y(){try{var t=kt;kt=null;return t.apply(this,arguments)}catch(e){xt.error=e;return xt}}function _(t){kt=t;return y}function d(t,e,r,n){try{t.call(e,r,n)}catch(o){return o}}function v(t,e,r){Ot.async(function(t){var n=!1,o=d(r,e,function(r){if(!n){n=!0;e!==r?w(t,r,void 0):j(t,r)}},function(e){if(!n){n=!0;E(t,e)}},"Settle: "+(t._label||" unknown promise"));if(!n&&o){n=!0;E(t,o)}},t)}function b(t,e){if(e._state===Pt)j(t,e._result);else if(e._state===St){e._onError=null;E(t,e._result)}else O(e,void 0,function(r){e!==r?w(t,r,void 0):j(t,r)},function(e){return E(t,e)})}function m(t,e,r){var n=e.constructor===t.constructor&&r===S&&t.constructor.resolve===a;if(n)b(t,e);else if(r===Rt){E(t,Rt.error);Rt.error=null}else o(r)?v(t,e,r):j(t,e)}function w(t,e){t===e?j(t,e):n(e)?m(t,e,p(e)):j(t,e)}function g(t){t._onError&&t._onError(t._result);A(t)}function j(t,e){if(t._state===Tt){t._result=e;t._state=Pt;0===t._subscribers.length?Ot.instrument&&c("fulfilled",t):Ot.async(A,t)}}function E(t,e){if(t._state===Tt){t._state=St;t._result=e;Ot.async(g,t)}}function O(t,e,r,n){var o=t._subscribers,i=o.length;t._onError=null;o[i]=e;o[i+Pt]=r;o[i+St]=n;0===i&&t._state&&Ot.async(A,t)}function A(t){var e=t._subscribers,r=t._state;Ot.instrument&&c(r===Pt?"fulfilled":"rejected",t);if(0!==e.length){for(var n=void 0,o=void 0,i=t._result,u=0;u<e.length;u+=3){n=e[u];o=e[u+r];n?T(r,n,o,i):o(i)}t._subscribers.length=0}}function T(t,e,r,n){var i=o(r),u=void 0,s=void 0;if(i){u=_(r)(n);if(u===xt){s=u.error;u.error=null}else if(u===e){E(e,f());return}}else u=n;e._state!==Tt||(i&&void 0===s?w(e,u):void 0!==s?E(e,s):t===Pt?j(e,u):t===St&&E(e,u))}function P(t,e){var r=!1;try{e(function(e){if(!r){r=!0;w(t,e)}},function(e){if(!r){r=!0;E(t,e)}})}catch(n){E(t,n)}}function S(t,e,r){var n=this,o=n._state;if(o===Pt&&!t||o===St&&!e){Ot.instrument&&c("chained",n,n);return n}n._onError=null;var i=new n.constructor(l,r),u=n._result;Ot.instrument&&c("chained",n,i);if(o===Tt)O(n,i,t,e);else{var s=o===Pt?t:e;Ot.async(function(){return T(o,i,s,u)})}return i}function R(t,e,r){this._remaining--;t===Pt?this._result[e]={state:"fulfilled",value:r}:this._result[e]={state:"rejected",reason:r}}function x(t,e){return Array.isArray(t)?new Mt(this,t,(!0),e).promise:this.reject(new TypeError("Promise.all must be called with an array"),e)}function k(t,e){var r=this,n=new r(l,e);if(!Array.isArray(t)){E(n,new TypeError("Promise.race must be called with an array"));return n}for(var o=0;n._state===Tt&&o<t.length;o++)O(r.resolve(t[o]),void 0,function(t){return w(n,t)},function(t){return E(n,t)});return n}function M(t,e){var r=this,n=new r(l,e);E(n,t);return n}function C(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function F(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function I(){this.value=void 0}function N(t){try{return t.then}catch(e){Nt.value=e;return Nt}}function V(t,e,r){try{t.apply(e,r)}catch(n){Nt.value=n;return Nt}}function U(t,e){for(var r={},n=t.length,o=new Array(n),i=0;i<n;i++)o[i]=t[i];for(var u=0;u<e.length;u++){var s=e[u];r[s]=o[u+1]}return r}function D(t){for(var e=t.length,r=new Array(e-1),n=1;n<e;n++)r[n-1]=t[n];return r}function K(t,e){return{then:function(r,n){return t.call(e,r,n)}}}function q(t,e){var r=function(){for(var r=this,n=arguments.length,o=new Array(n+1),i=!1,u=0;u<n;++u){var s=arguments[u];if(!i){i=W(s);if(i===Vt){var c=new It(l);E(c,Vt.value);return c}i&&i!==!0&&(s=K(i,s))}o[u]=s}var a=new It(l);o[n]=function(t,r){t?E(a,t):void 0===e?w(a,r):e===!0?w(a,D(arguments)):Array.isArray(e)?w(a,U(arguments,e)):w(a,r)};return i?L(a,o,t,r):G(a,o,t,r)};r.__proto__=t;return r}function G(t,e,r,n){var o=V(r,n,e);o===Nt&&E(t,o.value);return t}function L(t,e,r,n){return It.all(e).then(function(e){var o=V(r,n,e);o===Nt&&E(t,o.value);return t})}function W(t){return!(!t||"object"!=typeof t)&&(t.constructor===It||N(t))}function Y(t,e){return It.all(t,e)}function $(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function z(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}});e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function B(t,e){return Array.isArray(t)?new Ut(It,t,e).promise:It.reject(new TypeError("Promise.allSettled must be called with an array"),e)}function H(t,e){return It.race(t,e)}function J(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function Q(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}});e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function X(t,e){return i(t)?new Kt(It,t,e).promise:It.reject(new TypeError("Promise.hash must be called with an object"),e)}function Z(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function tt(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}});e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function et(t,e){return i(t)?new qt(It,t,(!1),e).promise:It.reject(new TypeError("RSVP.hashSettled must be called with an object"),e)}function rt(t){setTimeout(function(){throw t});throw t}function nt(t){var e={resolve:void 0,reject:void 0};e.promise=new It(function(t,r){e.resolve=t;e.reject=r},t);return e}function ot(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function it(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}});e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function ut(t,e,r){return Array.isArray(t)?o(e)?new Gt(It,t,e,r).promise:It.reject(new TypeError("RSVP.map expects a function as a second argument"),r):It.reject(new TypeError("RSVP.map must be called with an array"),r)}function st(t,e){return It.resolve(t,e)}function ct(t,e){return It.reject(t,e)}function at(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function ft(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}});e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function lt(t,e,r){return Array.isArray(t)||i(t)&&void 0!==t.then?o(e)?It.resolve(t,r).then(function(t){return new Wt(It,t,e,r).promise}):It.reject(new TypeError("RSVP.filter expects function as a second argument"),r):It.reject(new TypeError("RSVP.filter must be called with an array or promise"),r)}function ht(t,e){Xt[Yt]=t;Xt[Yt+1]=e;Yt+=2;2===Yt&&Zt()}function pt(){var t=process.nextTick,e=process.versions.node.match(/^(?:(\d+)\.)?(?:(\d+)\.)?(\*|\d+)$/);Array.isArray(e)&&"0"===e[1]&&"10"===e[2]&&(t=setImmediate);return function(){return t(bt)}}function yt(){return"undefined"!=typeof $t?function(){$t(bt)}:vt()}function _t(){var t=0,e=new Ht(bt),r=document.createTextNode("");e.observe(r,{characterData:!0});return function(){return r.data=t=++t%2}}function dt(){var t=new MessageChannel;t.port1.onmessage=bt;return function(){return t.port2.postMessage(0)}}function vt(){return function(){return setTimeout(bt,1)}}function bt(){for(var t=0;t<Yt;t+=2){var e=Xt[t],r=Xt[t+1];e(r);Xt[t]=void 0;Xt[t+1]=void 0}Yt=0}function mt(){try{var t=require,e=t("vertx");$t=e.runOnLoop||e.runOnContext;return yt()}catch(r){return vt()}}function wt(t,e,r){e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r;return t}function gt(){Ot.on.apply(Ot,arguments)}function jt(){Ot.off.apply(Ot,arguments)}var Et={mixin:function(t){t.on=this.on;t.off=this.off;t.trigger=this.trigger;t._promiseCallbacks=void 0;return t},on:function(t,r){if("function"!=typeof r)throw new TypeError("Callback must be a function");var n=e(this),o=void 0;o=n[t];o||(o=n[t]=[]);o.indexOf(r)&&o.push(r)},off:function(t,r){var n=e(this),o=void 0,i=void 0;if(r){o=n[t];i=o.indexOf(r);i!==-1&&o.splice(i,1)}else n[t]=[]},trigger:function(t,r,n){var o=e(this),i=void 0,u=void 0;if(i=o[t])for(var s=0;s<i.length;s++){u=i[s];u(r,n)}}},Ot={instrument:!1};Et.mixin(Ot);var At=[],Tt=void 0,Pt=1,St=2,Rt=new h,xt=new h,kt=void 0,Mt=function(){function t(t,e,r,n){this._instanceConstructor=t;this.promise=new t(l,n);this._abortOnReject=r;this.isUsingOwnPromise=t===It;this._init.apply(this,arguments)}t.prototype._init=function(t,e){var r=e.length||0;this.length=r;this._remaining=r;this._result=new Array(r);this._enumerate(e)};t.prototype._enumerate=function(t){for(var e=this.length,r=this.promise,n=0;r._state===Tt&&n<e;n++)this._eachEntry(t[n],n,!0);this._checkFullfillment()};t.prototype._checkFullfillment=function(){0===this._remaining&&j(this.promise,this._result)};t.prototype._settleMaybeThenable=function(t,e,r){var n=this._instanceConstructor,o=n.resolve;if(o===a){var i=p(t);if(i===S&&t._state!==Tt){t._onError=null;this._settledAt(t._state,e,t._result,r)}else if("function"!=typeof i)this._settledAt(Pt,e,t,r);else if(this.isUsingOwnPromise){var u=new n(l);m(u,t,i);this._willSettleAt(u,e,r)}else this._willSettleAt(new n(function(e){return e(t)}),e,r)}else this._willSettleAt(o(t),e,r)};t.prototype._eachEntry=function(t,e,r){u(t)?this._settleMaybeThenable(t,e,r):this._setResultAt(Pt,e,t,r)};t.prototype._settledAt=function(t,e,r,n){var o=this.promise;if(o._state===Tt)if(this._abortOnReject&&t===St)E(o,r);else{this._setResultAt(t,e,r,n);this._checkFullfillment()}};t.prototype._setResultAt=function(t,e,r,n){this._remaining--;this._result[e]=r};t.prototype._willSettleAt=function(t,e,r){var n=this;O(t,void 0,function(t){return n._settledAt(Pt,e,t,r)},function(t){return n._settledAt(St,e,t,r)})};return t}(),Ct="rsvp_"+Date.now()+"-",Ft=0,It=function(){function t(e,r){this._id=Ft++;this._label=r;this._state=void 0;this._result=void 0;this._subscribers=[];Ot.instrument&&c("created",this);if(l!==e){"function"!=typeof e&&C();this instanceof t?P(this,e):F()}}t.prototype._onError=function(t){var e=this;Ot.after(function(){e._onError&&Ot.trigger("error",t,e._label)})};t.prototype["catch"]=function(t,e){return this.then(void 0,t,e)};t.prototype["finally"]=function(t,e){var r=this,n=r.constructor;return r.then(function(e){return n.resolve(t()).then(function(){return e})},function(e){return n.resolve(t()).then(function(){throw e})},e)};return t}();It.cast=a;It.all=x;It.race=k;It.resolve=a;It.reject=M;It.prototype._guidKey=Ct;It.prototype.then=S;var Nt=new I,Vt=new I,Ut=function(t){function e(e,r,n){return $(this,t.call(this,e,r,!1,n))}z(e,t);return e}(Mt);Ut.prototype._setResultAt=R;var Dt=Object.prototype.hasOwnProperty,Kt=function(t){function e(e,r){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],o=arguments[3];return J(this,t.call(this,e,r,n,o))}Q(e,t);e.prototype._init=function(t,e){this._result={};this._enumerate(e);0===this._remaining&&j(this.promise,this._result)};e.prototype._enumerate=function(t){var e=this.promise,r=[];for(var n in t)Dt.call(t,n)&&r.push({position:n,entry:t[n]});var o=r.length;this._remaining=o;for(var i=void 0,u=0;e._state===Tt&&u<o;u++){i=r[u];this._eachEntry(i.entry,i.position)}};return e}(Mt),qt=function(t){function e(e,r,n){return Z(this,t.call(this,e,r,!1,n))}tt(e,t);return e}(Kt);qt.prototype._setResultAt=R;var Gt=function(t){function e(e,r,n,o){return ot(this,t.call(this,e,r,!0,o,n))}it(e,t);e.prototype._init=function(t,e,r,n,o){var i=e.length||0;this.length=i;this._remaining=i;this._result=new Array(i);this._mapFn=o;this._enumerate(e)};e.prototype._setResultAt=function(t,e,r,n){if(n){var o=_(this._mapFn)(r,e);o===xt?this._settledAt(St,e,o.error,!1):this._eachEntry(o,e,!1)}else{this._remaining--;this._result[e]=r}};return e}(Mt),Lt={},Wt=function(t){function e(e,r,n,o){return at(this,t.call(this,e,r,!0,o,n))}ft(e,t);e.prototype._init=function(t,e,r,n,o){var i=e.length||0;this.length=i;this._remaining=i;this._result=new Array(i);this._filterFn=o;this._enumerate(e)};e.prototype._checkFullfillment=function(){if(0===this._remaining){this._result=this._result.filter(function(t){return t!==Lt});j(this.promise,this._result)}};e.prototype._setResultAt=function(t,e,r,n){if(n){this._result[e]=r;var o=_(this._filterFn)(r,e);o===xt?this._settledAt(St,e,o.error,!1):this._eachEntry(o,e,!1)}else{this._remaining--;r!==!0&&(this._result[e]=Lt)}};return e}(Mt),Yt=0,$t=void 0,zt="undefined"!=typeof window?window:void 0,Bt=zt||{},Ht=Bt.MutationObserver||Bt.WebKitMutationObserver,Jt="undefined"==typeof self&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process),Qt="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,Xt=new Array(1e3),Zt=void 0;Zt=Jt?pt():Ht?_t():Qt?dt():void 0===zt&&"function"==typeof require?mt():vt();var te=void 0;if("object"==typeof self)te=self;else{if("object"!=typeof global)throw new Error("no global: `self` or `global` found");te=global}var ee;Ot.async=ht;Ot.after=function(t){return setTimeout(t,0)};var re=st,ne=function(t,e){return Ot.async(t,e)};if("undefined"!=typeof window&&"object"==typeof window.__PROMISE_INSTRUMENTATION__){var oe=window.__PROMISE_INSTRUMENTATION__;r("instrument",!0);for(var ie in oe)oe.hasOwnProperty(ie)&&gt(ie,oe[ie])}var ue=(ee={asap:ht,cast:re,Promise:It,EventTarget:Et,all:Y,allSettled:B,race:H,hash:X,hashSettled:et,rethrow:rt,defer:nt,denodeify:q,configure:r,on:gt,off:jt,resolve:st,reject:ct,map:ut},wt(ee,"async",ne),wt(ee,"filter",lt),ee);t["default"]=ue;t.asap=ht;t.cast=re;t.Promise=It;t.EventTarget=Et;t.all=Y;t.allSettled=B;t.race=H;t.hash=X;t.hashSettled=et;t.rethrow=rt;t.defer=nt;t.denodeify=q;t.configure=r;t.on=gt;t.off=jt;t.resolve=st;t.reject=ct;t.map=ut;t.async=ne;t.filter=lt;Object.defineProperty(t,"__esModule",{value:!0})});

@@ -22,2 +22,6 @@ import {

function ErrorObject() {
this.error = null;
}
const GET_THEN_ERROR = new ErrorObject();

@@ -34,2 +38,21 @@

export const TRY_CATCH_ERROR = new ErrorObject();
let tryCatchCallback;
function tryCatcher() {
try {
var target = tryCatchCallback;
tryCatchCallback = null;
return target.apply(this, arguments);
} catch(e) {
TRY_CATCH_ERROR.error = e;
return TRY_CATCH_ERROR;
}
}
export function tryCatch(fn) {
tryCatchCallback = fn;
return tryCatcher;
}
function tryThen(then, value, fulfillmentHandler, rejectionHandler) {

@@ -184,17 +207,2 @@ try {

function ErrorObject() {
this.error = null;
}
const TRY_CATCH_ERROR = new ErrorObject();
function tryCatch(callback, result) {
try {
return callback(result);
} catch(e) {
TRY_CATCH_ERROR.error = e;
return TRY_CATCH_ERROR;
}
}
export function invokeCallback(state, promise, callback, result) {

@@ -205,3 +213,3 @@ let hasCallback = isFunction(callback);

if (hasCallback) {
value = tryCatch(callback, result);
value = tryCatch(callback)(result);

@@ -208,0 +216,0 @@ if (value === TRY_CATCH_ERROR) {

import {
default as Enumerator,
makeSettledResult
setSettledResult
} from './enumerator';
import Promise from './promise';
import { isArray } from './utils';

@@ -14,3 +13,3 @@ class AllSettled extends Enumerator {

AllSettled.prototype._makeResult = makeSettledResult;
AllSettled.prototype._setResultAt = setSettledResult;

@@ -70,3 +69,3 @@ /**

export default function allSettled(entries, label) {
if (!isArray(entries)) {
if (!Array.isArray(entries)) {
return Promise.reject(new TypeError("Promise.allSettled must be called with an array"), label);

@@ -73,0 +72,0 @@ }

import {
isArray,
isMaybeThenable

@@ -19,5 +18,5 @@ } from './utils';

import Promise from './promise';
import originalThen from './then';
import originalResolve from './promise/resolve';
import { default as OwnPromise } from './promise';
import ownThen from './then';
import ownResolve from './promise/resolve';

@@ -29,2 +28,3 @@ export default class Enumerator {

this._abortOnReject = abortOnReject;
this.isUsingOwnPromise = Constructor === OwnPromise;

@@ -41,5 +41,2 @@ this._init(...arguments);

this._enumerate(input);
if (this._remaining === 0) {
fulfill(this.promise, this._result);
}
}

@@ -52,41 +49,47 @@

for (let i = 0; promise._state === PENDING && i < length; i++) {
this._eachEntry(input[i], i);
this._eachEntry(input[i], i, true);
}
this._checkFullfillment();
}
_settleMaybeThenable(entry, i) {
_checkFullfillment() {
if (this._remaining === 0) {
fulfill(this.promise, this._result);
}
}
_settleMaybeThenable(entry, i, firstPass) {
let c = this._instanceConstructor;
let resolve = c.resolve;
if (resolve === originalResolve) {
if (resolve === ownResolve) {
let then = getThen(entry);
if (then === originalThen && entry._state !== PENDING) {
if (then === ownThen && entry._state !== PENDING) {
entry._onError = null;
this._settledAt(entry._state, i, entry._result);
this._settledAt(entry._state, i, entry._result, firstPass);
} else if (typeof then !== 'function') {
this._remaining--;
this._result[i] = this._makeResult(FULFILLED, i, entry);
} else if (c === Promise) {
this._settledAt(FULFILLED, i, entry, firstPass);
} else if (this.isUsingOwnPromise) {
let promise = new c(noop);
handleMaybeThenable(promise, entry, then);
this._willSettleAt(promise, i);
this._willSettleAt(promise, i, firstPass);
} else {
this._willSettleAt(new c(resolve => resolve(entry)), i);
this._willSettleAt(new c(resolve => resolve(entry)), i, firstPass);
}
} else {
this._willSettleAt(resolve(entry), i);
this._willSettleAt(resolve(entry), i, firstPass);
}
}
_eachEntry(entry, i) {
_eachEntry(entry, i, firstPass) {
if (isMaybeThenable(entry)) {
this._settleMaybeThenable(entry, i);
this._settleMaybeThenable(entry, i, firstPass);
} else {
this._remaining--;
this._result[i] = this._makeResult(FULFILLED, i, entry);
this._setResultAt(FULFILLED, i, entry, firstPass);
}
}
_settledAt(state, i, value) {
_settledAt(state, i, value, firstPass) {
let promise = this.promise;

@@ -98,7 +101,4 @@

} else {
this._remaining--;
this._result[i] = this._makeResult(state, i, value);
if (this._remaining === 0) {
fulfill(promise, this._result);
}
this._setResultAt(state, i, value, firstPass);
this._checkFullfillment();
}

@@ -108,13 +108,12 @@ }

_makeResult(state, i, value) {
return value;
_setResultAt(state, i, value, firstPass) {
this._remaining--;
this._result[i] = value;
}
_willSettleAt(promise, i) {
let enumerator = this;
_willSettleAt(promise, i, firstPass) {
subscribe(
promise, undefined,
value => enumerator._settledAt(FULFILLED, i, value),
reason => enumerator._settledAt(REJECTED, i, reason)
value => this._settledAt(FULFILLED, i, value, firstPass),
reason => this._settledAt(REJECTED, i, reason, firstPass)
);

@@ -124,5 +123,6 @@ }

export function makeSettledResult(state, position, value) {
export function setSettledResult(state, i, value) {
this._remaining--;
if (state === FULFILLED) {
return {
this._result[i] = {
state: 'fulfilled',

@@ -132,3 +132,3 @@ value: value

} else {
return {
this._result[i] = {
state: 'rejected',

@@ -135,0 +135,0 @@ reason: value

@@ -1,9 +0,2 @@

function indexOf(callbacks, callback) {
for (let i=0, l=callbacks.length; i<l; i++) {
if (callbacks[i] === callback) { return i; }
}
return -1;
}
function callbacksFor(object) {

@@ -104,3 +97,3 @@ let callbacks = object._promiseCallbacks;

if (indexOf(callbacks, callback) === -1) {
if (callbacks.indexOf(callback)) {
callbacks.push(callback);

@@ -159,3 +152,3 @@ }

index = indexOf(callbacks, callback);
index = callbacks.indexOf(callback);

@@ -162,0 +155,0 @@ if (index !== -1) { callbacks.splice(index, 1); }

import Promise from './promise';
import Enumerator from './enumerator';
import {
isFunction,
isArray,
isObject
} from './utils';
import {
tryCatch,
fulfill,
TRY_CATCH_ERROR,
REJECTED
} from './-internal';
const EMPTY_OBJECT = {};
class FilterEnumerator extends Enumerator {
constructor(Constructor, entries, filterFn, label) {
super(Constructor, entries, true, label, filterFn);
}
_init(Constructor, input, bool, label, filterFn) {
let len = input.length || 0;
this.length = len;
this._remaining = len;
this._result = new Array(len);
this._filterFn = filterFn;
this._enumerate(input);
}
_checkFullfillment() {
if (this._remaining === 0) {
this._result = this._result.filter((val) => val !== EMPTY_OBJECT);
fulfill(this.promise, this._result);
}
}
_setResultAt(state, i, value, firstPass) {
if (firstPass) {
this._result[i] = value;
let val = tryCatch(this._filterFn)(value, i);
if (val === TRY_CATCH_ERROR) {
this._settledAt(REJECTED, i, val.error, false);
} else {
this._eachEntry(val, i, false);
}
} else {
this._remaining--;
if (value !== true) {
this._result[i] = EMPTY_OBJECT;
}
}
}
}
/**
`RSVP.filter` is similar to JavaScript's native `filter` method, except that it
waits for all promises to become fulfilled before running the `filterFn` on
each item in given to `promises`. `RSVP.filter` returns a promise that will
become fulfilled with the result of running `filterFn` on the values the
promises become fulfilled with.
`RSVP.filter` is similar to JavaScript's native `filter` method.
`filterFn` is eagerly called meaning that as soon as any promise
resolves its value will be passed to `filterFn`. `RSVP.filter` returns
a promise that will become fulfilled with the result of running
`filterFn` on the values the promises become fulfilled with.

@@ -94,14 +143,4 @@ For example:

function resolveAll(promises, label) {
return Promise.all(promises, label);
}
function resolveSingle(promise, label) {
return Promise.resolve(promise, label).then(function(promises){
return resolveAll(promises, label);
});
}
export default function filter(promises, filterFn, label) {
if (!isArray(promises) && !(isObject(promises) && promises.then !== undefined )) {
if (!Array.isArray(promises) && !(isObject(promises) && promises.then !== undefined )) {
return Promise.reject(new TypeError("RSVP.filter must be called with an array or promise"), label);

@@ -114,27 +153,6 @@ }

let promise = isArray(promises) ? resolveAll(promises, label) : resolveSingle(promises, label);
return promise.then(values => {
let length = values.length;
let filtered = new Array(length);
for (let i = 0; i < length; i++) {
filtered[i] = filterFn(values[i]);
}
return resolveAll(filtered, label).then(filtered => {
let results = new Array(length);
let newLength = 0;
for (let i = 0; i < length; i++) {
if (filtered[i]) {
results[newLength] = values[i];
newLength++;
}
}
results.length = newLength;
return results;
return Promise.resolve(promises, label)
.then(function(promises) {
return new FilterEnumerator(Promise, promises, filterFn, label).promise;
});
});
}
import Promise from './promise';
import {
default as Enumerator,
setSettledResult
} from './enumerator';
import PromiseHash from './promise-hash';

@@ -12,3 +16,3 @@ import { isObject } from './utils';

HashSettled.prototype._makeResult = makeSettledResult;
HashSettled.prototype._setResultAt = setSettledResult;

@@ -15,0 +19,0 @@ /**

@@ -35,3 +35,3 @@ import { config } from './config';

label: promise._label,
timeStamp: now(),
timeStamp: Date.now(),
error: config["instrument-with-stack"] ? new Error(promise._label) : null

@@ -38,0 +38,0 @@ }})) {

import Promise from './promise';
import {
isFunction,
isArray
default as Enumerator
} from './enumerator';
import {
isFunction
} from './utils';
import {
tryCatch,
TRY_CATCH_ERROR,
REJECTED
} from './-internal';
class MapEnumerator extends Enumerator {
constructor(Constructor, entries, mapFn, label) {
super(Constructor, entries, true, label, mapFn);
}
_init(Constructor, input, bool, label, mapFn) {
let len = input.length || 0;
this.length = len;
this._remaining = len;
this._result = new Array(len);
this._mapFn = mapFn;
this._enumerate(input);
}
_setResultAt(state, i, value, firstPass) {
if (firstPass) {
let val = tryCatch(this._mapFn)(value, i);
if (val === TRY_CATCH_ERROR) {
this._settledAt(REJECTED, i, val.error, false);
} else {
this._eachEntry(val, i, false);
}
} else {
this._remaining--;
this._result[i] = value;
}
}
}
/**
`RSVP.map` is similar to JavaScript's native `map` method, except that it
waits for all promises to become fulfilled before running the `mapFn` on
each item in given to `promises`. `RSVP.map` returns a promise that will
become fulfilled with the result of running `mapFn` on the values the promises
become fulfilled with.
`RSVP.map` is similar to JavaScript's native `map` method. `mapFn` is eagerly called
meaning that as soon as any promise resolves its value will be passed to `mapFn`.
`RSVP.map` returns a promise that will become fulfilled with the result of running
`mapFn` on the values the promises become fulfilled with.

@@ -87,3 +124,3 @@ For example:

export default function map(promises, mapFn, label) {
if (!isArray(promises)) {
if (!Array.isArray(promises)) {
return Promise.reject(new TypeError("RSVP.map must be called with an array"), label);

@@ -96,12 +133,3 @@ }

return Promise.all(promises, label).then(values => {
let length = values.length;
let results = new Array(length);
for (let i = 0; i < length; i++) {
results[i] = mapFn(values[i]);
}
return Promise.all(results, label);
});
return new MapEnumerator(Promise, promises, mapFn, label).promise;
}

@@ -7,3 +7,2 @@ import Promise from './promise';

} from './-internal';
import { isArray } from './utils';

@@ -233,3 +232,3 @@ function Result() {

resolve(promise, arrayResult(arguments));
else if (isArray(options))
else if (Array.isArray(options))
resolve(promise, makeObject(arguments, options));

@@ -236,0 +235,0 @@ else

@@ -5,4 +5,3 @@ import { config } from './config';

import {
isFunction,
now
isFunction
} from './utils';

@@ -20,3 +19,3 @@

const guidKey = 'rsvp_' + now() + '-';
const guidKey = 'rsvp_' + Date.now() + '-';
let counter = 0;

@@ -239,3 +238,3 @@

}
};
}

@@ -242,0 +241,0 @@ Promise.cast = Resolve; // deprecated

import Enumerator from '../enumerator';
import { isArray } from '../utils';

@@ -52,3 +51,3 @@ /**

export default function all(entries, label) {
if (!isArray(entries)) {
if (!Array.isArray(entries)) {
return this.reject(new TypeError("Promise.all must be called with an array"), label);

@@ -55,0 +54,0 @@ }

import {
isArray
} from "../utils";
import {
noop,

@@ -85,3 +81,3 @@ resolve,

if (!isArray(entries)) {
if (!Array.isArray(entries)) {
reject(promise, new TypeError('Promise.race must be called with an array'));

@@ -92,5 +88,7 @@ return promise;

for (let i = 0; promise._state === PENDING && i < entries.length; i++) {
subscribe(Constructor.resolve(entries[i]), undefined,
subscribe(
Constructor.resolve(entries[i]), undefined,
value => resolve(promise, value),
reason => reject(promise, reason));
reason => reject(promise, reason)
);
}

@@ -97,0 +95,0 @@

@@ -17,14 +17,1 @@ export function objectOrFunction(x) {

}
let _isArray;
if (Array.isArray) {
_isArray = Array.isArray;
} else {
_isArray = x => Object.prototype.toString.call(x) === '[object Array]';
}
export const isArray = _isArray;
// Date.now is not available in browsers < IE9
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/now#Compatibility
export const now = Date.now || (() => new Date().getTime());
{
"name": "rsvp",
"namespace": "RSVP",
"version": "3.6.2",
"version": "4.0.0",
"description": "A lightweight library that provides tools for organizing asynchronous code",

@@ -6,0 +6,0 @@ "main": "dist/rsvp.js",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc