Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

asynquence

Package Overview
Dependencies
Maintainers
1
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

asynquence - npm Package Compare versions

Comparing version 0.5.0-a to 0.5.1-a

4

asq.js
/*! asynquence
v0.5.0-a (c) Kyle Simpson
v0.5.1-a (c) Kyle Simpson
MIT License: http://getify.mit-license.org
*/
!function(n,e,t){"undefined"!=typeof module&&module.exports?module.exports=t():"function"==typeof define&&define.amd?define(t):e[n]=t(n,e)}("ASQ",this,function(n,e){"use strict";function t(){function n(n,e){this.fn=n,this.self=e,this.next=void 0}var e,t,u;return{add:function(r,a){u=new n(r,a),t?t.next=u:e=u,t=u,u=void 0},drain:function(){for(;e;)e.fn.call(e.self),e=e.next;s=t=e}}}function u(n,e){p.add(n,e),s||(s=g(p.drain))}function r(){function n(){P?t():Q||(Q=u(t))}function e(){throw 1===F.length?F[0]:F}function t(){var t,u;if(Q=null,delete G.unpause,P)clearTimeout(Q),Q=null,z.length=B.length=D.length=F.length=0;else if(C)for(0!==B.length||M||(M=!0,e());B.length;){M=!0,t=B.shift();try{t.apply(x,F)}catch(r){v(r)?F=F.concat(r):(F.push(r),r.stack&&F.push(r.stack)),0===B.length&&e()}}else if(W&&z.length>0){W=!1,t=z.shift(),u=D.slice(),D.length=0,u.unshift(i());try{t.apply(x,u)}catch(r){v(r)?F=F.concat(r):F.push(r),C=!0,n()}}}function i(){function e(){C||P||W||(W=!0,D.push.apply(D,arguments),F.length=0,n())}return e.fail=function(){C||P||W||(C=!0,D.length=0,F.push.apply(F,arguments),n())},e.abort=function(){C||P||(W=!1,P=!0,D.length=F.length=0,n())},e.errfcb=function(n){n?e.fail(n):e.apply(x,q.call(arguments,1))},e}function l(n,e,t){function r(){clearTimeout(p),p=d=b=s=null}function a(){return h?i():(p||(p=u(i)),void 0)}function i(){if(!(C||P||m)){var e=[];p=null,g?(n.fail.apply(x,s),r()):h?(n.abort(),r()):l()&&(m=!0,d.forEach(function(n,t){e.push(b["s"+t])}),n.apply(x,e),r())}}function l(){if(0!==d.length){var n=!0;return d.some(function(e){return null===e?(n=!1,!0):void 0}),n}}function c(){function n(){if(!(C||P||g||h||m||d[e])){var n=y.apply(x,arguments);b["s"+e]=n.length>1?n:n[0],d[e]=!0,a()}}var e=d.length;return n.fail=function(){C||P||g||h||m||d[e]||(g=!0,s=q.call(arguments),a())},n.abort=function(){C||P||g||h||m||(h=!0,i())},n.errfcb=function(e){e?n.fail(e):n.apply(x,q.call(arguments,1))},d[e]=null,n}var f,o,s,p,g=!1,h=!1,m=!1,d=[],b={};e.some(function(n){if(g||h)return!0;f=t.slice(),f.unshift(c());try{n.apply(x,f)}catch(e){return o=e,g=!0,!0}}),o&&(v(o)?n.fail.apply(x,o):n.fail(o))}function s(){return C||P||0===arguments.length?G:(z.push.apply(z,o(arguments,f)),n(),G)}function p(){return P||0===arguments.length?G:(B.push.apply(B,arguments),n(),G)}function g(){if(C||P||0===arguments.length)return G;var n=q.call(arguments);return s(function(e){var t=q.call(arguments,1);l(e,n,t)}),G}function h(){return P||0===arguments.length?G:(q.call(arguments).forEach(function(n){s(function(e){n.apply(x,q.call(arguments,1)),e()}).or(n.fail)}),G)}function _(){return C||P||0===arguments.length?G:(q.call(arguments).forEach(function(n){var e;d(n)&&(n.defer(),"next"in n&&(n.then(function(){e.apply(x,arguments)}).or(function(){e.fail.apply(x,arguments)}),n=r(function(n){e=n}).defer(),e=function(){n=r.apply(x,arguments).defer()},e.fail=function(){var e=q.call(arguments);n=r(function(n){n.fail.apply(x,e)}).defer()})),s(function(e){var t=n;d(n)||(t=n.apply(x,q.call(arguments,1))),t.pipe(e)})}),G)}function k(){return C||P||0===arguments.length?G:(q.call(o(arguments,c)).forEach(function(n){s(function(e){var t=n.apply(x,q.call(arguments,1));v(t)||(t=y(t)),e.apply(x,t)})}),G)}function A(){function n(n){return function(){n.apply(x,v(arguments[0])?arguments[0]:arguments)}}return C||P||0===arguments.length?G:(q.call(arguments).forEach(function(e){s(function(t){var u=e;"function"!=typeof e||"then"in e||(u=e.apply(x,q.call(arguments,1))),u.then(n(t),n(t.fail))})}),G)}function E(){var n;return k(function(){return n?n.apply(x,arguments):n=r.apply(x,arguments).defer(),y.apply(x,arguments)}),p(function(){if(n)n.fail.apply(x,arguments);else{var e=q.call(arguments);n=r().then(function(n){n.fail.apply(x,e)}).defer()}}),r().then(function(e){n?n.pipe(e):n=e}).defer()}function j(){return C?G:(P=!0,t(),G)}function w(){var n;return m={then_queue:z.slice(),or_queue:B.slice()},n=r(),m=null,n}function O(){D.push.apply(D,arguments),Q===!0&&(Q=null),n()}function S(){return B.push(function(){}),G}function T(n,e){var t=arguments.length>1;switch(n){case"seq_error":if(!t)return C;C=e;break;case"seq_aborted":if(!t)return P;P=e;break;case"then_ready":if(!t)return W;W=e;break;case"then_queue":return z;case"or_queue":return B;case"sequence_messages":return D;case"sequence_errors":return F}}function I(){Object.keys(b).forEach(function(n){G[n]=b[n](G,T)})}var Q,C=!1,M=!1,P=!1,W=!0,z=[],B=[],D=[],F=[],G=a({then:s,or:p,gate:g,pipe:h,seq:_,val:k,promise:A,fork:E,abort:j,duplicate:w,defer:S});return I(),m&&(z=m.then_queue.slice(),B=m.or_queue.slice(),G.unpause=O,Q=!0),G.then.apply(x,o(arguments,f)),G}function a(n){return Object.defineProperty(n,k,{enumerable:!1,value:!0})}function i(n){return null!=n&&"object"==typeof n&&n[k]}function l(n,e){return q.call(e).slice(1,n+1)}function c(n){return y.apply(x,l(n,arguments))}function f(n){arguments[n+1].apply(x,l(n,arguments))}function o(n,e){var t,u;for(n=q.call(n),t=0;t<n.length;t++)if(v(n[t]))n[t]=e.bind.apply(e,[null,n[t].length].concat(n[t]));else if("function"!=typeof n[t]){for(u=t+1;u<n.length&&("function"!=typeof n[u]&&!i(n[u]));u++);n.splice(t,u-t,e.bind.apply(e,[null,u-t].concat(n.slice(t,u))))}return n}var s,p,g="undefined"!=typeof setImmediate?function(n){return setImmediate(n)}:setTimeout;p=t();var h,m,y,d,v,b={},_=(e||{})[n],q=[].slice,k="__ASQ__",x=Object.create(null);return h=r,h.failed=function(){var n=h.messages.apply(x,arguments);return r(function(){throw n})},h.extend=function(n,e){return~["then","or","gate","pipe","seq","val","promise","fork","abort","duplicate","defer"].indexOf(n)||(b[n]=e),h},h.messages=y=function(){var n=q.call(arguments);return a(n)},h.isSequence=d=function(n){return i(n)&&!Array.isArray(n)},h.isMessageWrapper=v=function(n){return i(n)&&Array.isArray(n)},h.unpause=function(n){return n.unpause&&n.unpause(),n},h.noConflict=function(){return e&&(e[n]=_),h},h});
!function(n,e,t){"undefined"!=typeof module&&module.exports?module.exports=t():"function"==typeof define&&define.amd?define(t):e[n]=t(n,e)}("ASQ",this,function(n,e){"use strict";function t(){function n(n){this.fn=n,this.next=void 0}var e,t,u;return{add:function(r){u=new n(r),t?t.next=u:e=u,t=u,u=void 0},drain:function(n){for(;e;)e.fn(n),e=e.next;s=t=e}}}function u(n){p.add(n),s||(s=g(p.drain))}function r(){function n(){P?t():Q||(Q=u(t))}function e(){throw 1===F.length?F[0]:F}function t(){var t,u;if(Q=null,delete G.unpause,P)clearTimeout(Q),Q=null,z.length=B.length=D.length=F.length=0;else if(C)for(0!==B.length||M||(M=!0,e());B.length;){M=!0,t=B.shift();try{t.apply(x,F)}catch(r){v(r)?F=F.concat(r):(F.push(r),r.stack&&F.push(r.stack)),0===B.length&&e()}}else if(W&&z.length>0){W=!1,t=z.shift(),u=D.slice(),D.length=0,u.unshift(i());try{t.apply(x,u)}catch(r){v(r)?F=F.concat(r):F.push(r),C=!0,n()}}}function i(){function e(){C||P||W||(W=!0,D.push.apply(D,arguments),F.length=0,n())}return e.fail=function(){C||P||W||(C=!0,D.length=0,F.push.apply(F,arguments),n())},e.abort=function(){C||P||(W=!1,P=!0,D.length=F.length=0,n())},e.errfcb=function(n){n?e.fail(n):e.apply(x,q.call(arguments,1))},e}function l(n,e,t){function r(){clearTimeout(p),p=d=b=s=null}function a(){return h?i():(p||(p=u(i)),void 0)}function i(){if(!(C||P||m)){var e=[];p=null,g?(n.fail.apply(x,s),r()):h?(n.abort(),r()):l()&&(m=!0,d.forEach(function(n,t){e.push(b["s"+t])}),n.apply(x,e),r())}}function l(){if(0!==d.length){var n=!0;return d.some(function(e){return null===e?(n=!1,!0):void 0}),n}}function c(){function n(){if(!(C||P||g||h||m||d[e])){var n=y.apply(x,arguments);b["s"+e]=n.length>1?n:n[0],d[e]=!0,a()}}var e=d.length;return n.fail=function(){C||P||g||h||m||d[e]||(g=!0,s=q.call(arguments),a())},n.abort=function(){C||P||g||h||m||(h=!0,i())},n.errfcb=function(e){e?n.fail(e):n.apply(x,q.call(arguments,1))},d[e]=null,n}var f,o,s,p,g=!1,h=!1,m=!1,d=[],b={};e.some(function(n){if(g||h)return!0;f=t.slice(),f.unshift(c());try{n.apply(x,f)}catch(e){return o=e,g=!0,!0}}),o&&(v(o)?n.fail.apply(x,o):n.fail(o))}function s(){return C||P||0===arguments.length?G:(z.push.apply(z,o(arguments,f)),n(),G)}function p(){return P||0===arguments.length?G:(B.push.apply(B,arguments),n(),G)}function g(){if(C||P||0===arguments.length)return G;var n=q.call(arguments);return s(function(e){var t=q.call(arguments,1);l(e,n,t)}),G}function h(){return P||0===arguments.length?G:(q.call(arguments).forEach(function(n){s(function(e){n.apply(x,q.call(arguments,1)),e()}).or(n.fail)}),G)}function _(){return C||P||0===arguments.length?G:(q.call(arguments).forEach(function(n){var e;d(n)&&(n.defer(),"next"in n&&(n.then(function(){e.apply(x,arguments)}).or(function(){e.fail.apply(x,arguments)}),n=r(function(n){e=n}).defer(),e=function(){n=r.apply(x,arguments).defer()},e.fail=function(){var e=q.call(arguments);n=r(function(n){n.fail.apply(x,e)}).defer()})),s(function(e){var t=n;d(n)||(t=n.apply(x,q.call(arguments,1))),t.pipe(e)})}),G)}function k(){return C||P||0===arguments.length?G:(q.call(o(arguments,c)).forEach(function(n){s(function(e){var t=n.apply(x,q.call(arguments,1));v(t)||(t=y(t)),e.apply(x,t)})}),G)}function A(){function n(n){return function(){n.apply(x,v(arguments[0])?arguments[0]:arguments)}}return C||P||0===arguments.length?G:(q.call(arguments).forEach(function(e){s(function(t){var u=e;"function"!=typeof e||"then"in e||(u=e.apply(x,q.call(arguments,1))),u.then(n(t),n(t.fail))})}),G)}function E(){var n;return k(function(){return n?n.apply(x,arguments):n=r.apply(x,arguments).defer(),y.apply(x,arguments)}),p(function(){if(n)n.fail.apply(x,arguments);else{var e=q.call(arguments);n=r().then(function(n){n.fail.apply(x,e)}).defer()}}),r().then(function(e){n?n.pipe(e):n=e}).defer()}function j(){return C?G:(P=!0,t(),G)}function w(){var n;return m={then_queue:z.slice(),or_queue:B.slice()},n=r(),m=null,n}function O(){D.push.apply(D,arguments),Q===!0&&(Q=null),n()}function S(){return B.push(function(){}),G}function T(n,e){var t=arguments.length>1;switch(n){case"seq_error":if(!t)return C;C=e;break;case"seq_aborted":if(!t)return P;P=e;break;case"then_ready":if(!t)return W;W=e;break;case"then_queue":return z;case"or_queue":return B;case"sequence_messages":return D;case"sequence_errors":return F}}function I(){Object.keys(b).forEach(function(n){G[n]=b[n](G,T)})}var Q,C=!1,M=!1,P=!1,W=!0,z=[],B=[],D=[],F=[],G=a({then:s,or:p,gate:g,pipe:h,seq:_,val:k,promise:A,fork:E,abort:j,duplicate:w,defer:S});return I(),m&&(z=m.then_queue.slice(),B=m.or_queue.slice(),G.unpause=O,Q=!0),G.then.apply(x,o(arguments,f)),G}function a(n){return Object.defineProperty(n,k,{enumerable:!1,value:!0})}function i(n){return null!=n&&"object"==typeof n&&n[k]}function l(n,e){return q.call(e).slice(1,n+1)}function c(n){return y.apply(x,l(n,arguments))}function f(n){arguments[n+1].apply(x,l(n,arguments))}function o(n,e){var t,u;for(n=q.call(n),t=0;t<n.length;t++)if(v(n[t]))n[t]=e.bind.apply(e,[null,n[t].length].concat(n[t]));else if("function"!=typeof n[t]){for(u=t+1;u<n.length&&("function"!=typeof n[u]&&!i(n[u]));u++);n.splice(t,u-t,e.bind.apply(e,[null,u-t].concat(n.slice(t,u))))}return n}var s,p,g="undefined"!=typeof setImmediate?function(n){return setImmediate(n)}:setTimeout;p=t();var h,m,y,d,v,b={},_=(e||{})[n],q=[].slice,k="__ASQ__",x=Object.create(null);return h=r,h.failed=function(){var n=h.messages.apply(x,arguments);return r(function(){throw n})},h.extend=function(n,e){return~["then","or","gate","pipe","seq","val","promise","fork","abort","duplicate","defer"].indexOf(n)||(b[n]=e),h},h.messages=y=function(){var n=q.call(arguments);return a(n)},h.isSequence=d=function(n){return i(n)&&!Array.isArray(n)},h.isMessageWrapper=v=function(n){return i(n)&&Array.isArray(n)},h.unpause=function(n){return n.unpause&&n.unpause(),n},h.noConflict=function(){return e&&(e[n]=_),h},h});
/*! asynquence
v0.5.0-a (c) Kyle Simpson
v0.5.1-a (c) Kyle Simpson
MIT License: http://getify.mit-license.org

@@ -23,5 +23,4 @@ */

function Item(fn,self) {
function Item(fn) {
this.fn = fn;
this.self = self;
this.next = void 0;

@@ -31,4 +30,4 @@ }

return {
add: function add(fn,self) {
item = new Item(fn,self);
add: function add(fn) {
item = new Item(fn);
if (last) {

@@ -45,3 +44,3 @@ last.next = item;

while (first) {
first.fn.call(first.self);
first.fn(self);
first = first.next;

@@ -56,4 +55,4 @@ }

function schedule(fn,self) {
scheduling_queue.add(fn,self);
function schedule(fn) {
scheduling_queue.add(fn);
if (!cycle) {

@@ -60,0 +59,0 @@ cycle = timer(scheduling_queue.drain);

{
"name": "asynquence",
"version": "0.5.0-a",
"version": "0.5.1-a",
"description": "asynquence: promise-style async sequence flow-control",

@@ -5,0 +5,0 @@ "main": "./asq.js",

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