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.2.0-b to 0.2.0-c

2

asq.js
/*! asynquence
v0.2.0-a (c) Kyle Simpson
v0.2.0-c (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(n){return"undefined"!=typeof setImmediate?setImmediate(n):setTimeout(n,0)}function r(){function n(){clearTimeout(E),E=null,S.length=0,T.length=0,I.length=0,Q.length=0}function e(){return x?r():(E||(E=t(r)),void 0)}function r(){var t,r;if(E=null,x)n();else if(j)for(;T.length;){t=T.shift();try{t.apply(m,Q)}catch(u){a(u)?Q=Q.concat(u):(Q.push(u),u.stack&&Q.push(u.stack)),0===T.length&&console.error.apply(console,Q)}}else if(O&&S.length>0){O=!1,t=S.shift(),r=I.slice(),I.length=0,r.unshift(l());try{t.apply(m,r)}catch(u){a(u)?Q=Q.concat(u):Q.push(u),j=!0,e()}}}function l(){function n(){j||x||O||(O=!0,I.push.apply(I,arguments),Q.length=0,e())}return n.fail=function(){j||x||O||(j=!0,I.length=0,Q.push.apply(Q,arguments),e())},n.abort=function(){j||x||(O=!1,x=!0,I.length=0,Q.length=0,e())},n}function p(n,e,r){function u(){clearTimeout(y),y=_=q=h=null}function l(){return v?c():(y||(y=t(c)),void 0)}function c(){if(!(j||x||b)){var e=[];y=null,d?(n.fail.apply(m,h),u()):v?(n.abort(),u()):i()&&(b=!0,_.forEach(function(n,t){e.push(q["s"+t])}),n.apply(m,e),u())}}function i(){if(!(j||x||d||v||b||0===_.length)){var n=!0;return _.some(function(e){return null===e?(n=!1,!0):void 0}),n}}function o(){function n(){if(!(j||x||d||v||b||_[e])){var n=s.messages.apply(m,arguments);q["s"+e]=n.length>1?n:n[0],_[e]=!0,l()}}var e=_.length;return n.fail=function(){j||x||d||v||b||_[e]||(d=!0,h=g.call(arguments),l())},n.abort=function(){j||x||d||v||b||(v=!0,c())},_[e]=null,n}var f,p,h,y,d=!1,v=!1,b=!1,_=[],q={};e.some(function(n){if(d||v)return!0;f=r.slice(),f.unshift(o());try{n.apply(m,f)}catch(e){return p=e,d=!0,!0}}),p&&(a(p)?n.fail.apply(m,p):n.fail(p))}function h(){return j||x||0===arguments.length?w:(S.push.apply(S,o(arguments,i)),e(),w)}function y(){return x||0===arguments.length?w:(T.push.apply(T,arguments),e(),w)}function d(){if(j||x||0===arguments.length)return w;var n=g.call(arguments);return h(function(e){var t=g.call(arguments,1);p(e,n,t)}),w}function v(){return x||0===arguments.length?w:(g.call(arguments).forEach(function(n){h(function(e){n.apply(m,g.call(arguments,1)),e()}).or(n.fail)}),w)}function b(){return j||x||0===arguments.length?w:(g.call(arguments).forEach(function(n){h(function(e){a(n)||(n=n.apply(m,g.call(arguments,1))),n.pipe(e)})}),w)}function _(){return j||x||0===arguments.length?w:(g.call(o(arguments,c)).forEach(function(n){h(function(e){var t=n.apply(m,g.call(arguments,1));a(t)||(t=s.messages(t)),e.apply(m,t)})}),w)}function q(){return j?w:(x=!0,r(),w)}function k(n,e){var t=arguments.length>1;switch(n){case"seq_error":if(!t)return j;j=e;break;case"seq_aborted":if(!t)return x;x=e;break;case"then_ready":if(!t)return O;O=e;break;case"then_queue":return S;case"or_queue":return T;case"sequence_messages":return I;case"sequence_errors":return Q}}function A(){Object.keys(f).forEach(function(n){w[n]=f[n](w,k)})}var E,j=!1,x=!1,O=!0,S=[],T=[],I=[],Q=[],w=u({then:h,or:y,gate:d,pipe:v,seq:b,val:_,abort:q});return A(),w.then.apply(m,o(arguments,i)),w}function u(n){return Object.defineProperty(n,h,{enumerable:!1,value:!0}),n}function a(n){return null!=n&&"object"==typeof n&&n[h]}function l(n,e){return g.call(e).slice(1,n+1)}function c(n){return s.messages.apply(m,l(n,arguments))}function i(n){arguments[n+1].apply(m,l(n,arguments))}function o(n,e){var t,r;for(n=g.call(n),t=0;t<n.length;t++)if(Array.isArray(n[t])&&a(n[t]))n[t]=e.bind.apply(e,[null,n[t].length].concat(n[t]));else if("function"!=typeof n[t]){for(r=t+1;r<n.length&&("function"!=typeof n[r]&&!a(n[r]));r++);n.splice(t,r-t,e.bind.apply(e,[null,r-t].concat(n.slice(t,r))))}return n}var s,f={},p=(e||{})[n],g=Array.prototype.slice,h="__ASQ__",m=Object.create(null);return s=r,s.extend=function(n,e){return~["then","or","gate","pipe","seq","val","abort"].indexOf(n)||(f[n]=e),s},s.messages=function(){var n=g.call(arguments);return u(n),n},s.isMessageWrapper=s.isSequence=a,s.noConflict=function(){return e&&(e[n]=p),s},s});
/*! asynquence
v0.2.0-a (c) Kyle Simpson
v0.2.0-c (c) Kyle Simpson
MIT License: http://getify.mit-license.org

@@ -4,0 +4,0 @@ */

@@ -5,3 +5,6 @@ #!/usr/bin/env node

path = require("path"),
exec = require("child_process").exec
exec = require("child_process").exec,
ugly = require("uglify-js"),
result
;

@@ -12,7 +15,22 @@

exec("node_modules/.bin/uglifyjs asq.src.js --comments '/^\!/' --mangle --compress --output asq.js",function(){
// ensure trailing new-line
fs.appendFileSync(path.join(__dirname,"asq.js"),"\n");
try {
result = ugly.minify(path.join(__dirname,"asq.src.js"),{
mangle: true,
compress: true,
output: {
comments: /^!/
}
});
fs.writeFileSync(
path.join(__dirname,"asq.js"),
result.code + "\n",
{ encoding: "utf8" }
);
console.log("Complete.");
});
}
catch (err) {
console.error(err);
process.exit(1);
}
/*! asynquence
v0.2.0-a (c) Kyle Simpson
v0.2.0-c (c) Kyle Simpson
MIT License: http://getify.mit-license.org
*/
!function(n,t){"undefined"!=typeof module&&module.exports?module.exports=t(require(n)):"function"==typeof define&&define.amd?define([n],t):t(n)}(this.ASQ||"./asq.src.js",function(n){"use strict";var t=Array.prototype.slice,a=Object.create(null);return n.extend("all",function(n){return n.gate}),n.extend("any",function(e,r){return function(){if(r("seq_error")||r("seq_aborted")||0===arguments.length)return e;var u=t.call(arguments);return e.then(function(e){function r(){var n;l===u.length&&(n=[],s?(u.forEach(function(t,a){n.push(o["s"+a])}),e.apply(a,n)):(u.forEach(function(t,a){n.push(c["s"+a])}),e.fail.apply(a,n)))}var s=!1,l=0,o={},c={},p=n.apply(a,t.call(arguments,1));u=u.map(function(u,p){return function(f){var i=t.call(arguments);i[0]=function(){s=!0,l++,o["s"+p]=arguments.length>1?n.messages.apply(a,arguments):arguments[0],r()},i[0].fail=function(){l++,c["s"+p]=arguments.length>1?n.messages.apply(a,arguments):arguments[0],r()},i[0].abort=function(){s||(f.abort(),e.abort())},u.apply(a,i)}}),p.gate.apply(a,u)}),e}}),n.extend("first",function(e,r){return function(){if(r("seq_error")||r("seq_aborted")||0===arguments.length)return e;var u=t.call(arguments);return e.then(function(e){var r=0,s={},l=!1,o=n.apply(a,t.call(arguments,1));u=u.map(function(c,p){return function(f){var i=t.call(arguments);i[0]=function(){l||(l=!0,r++,e(arguments.length>1?n.messages.apply(a,arguments):arguments[0]),o.abort())},i[0].fail=function(){var t=[];r++,s["s"+p]=arguments.length>1?n.messages.apply(a,arguments):arguments[0],l||r!==u.length||(u.forEach(function(n,a){t.push(s["s"+a])}),e.fail.apply(a,t))},i[0].abort=function(){l||(f.abort(),e.abort())},c.apply(a,i)}}),o.gate.apply(a,u)}),e}}),n.extend("last",function(e,r){return function(){if(r("seq_error")||r("seq_aborted")||0===arguments.length)return e;var u=t.call(arguments);return e.then(function(e){function r(){var n;l===u.length&&(n=[],s?e(o):(u.forEach(function(t,a){n.push(c["s"+a])}),e.fail.apply(a,n)))}var s=!1,l=0,o={},c={},p=n.apply(a,t.call(arguments,1));u=u.map(function(u,p){return function(f){var i=t.call(arguments);i[0]=function(){s=!0,l++,o=arguments.length>1?n.messages.apply(a,arguments):arguments[0],r()},i[0].fail=function(){l++,c["s"+p]=arguments.length>1?n.messages.apply(a,arguments):arguments[0],r()},i[0].abort=function(){s||(f.abort(),e.abort())},u.apply(a,i)}}),p.gate.apply(a,u)}),e}}),n.extend("none",function(e,r){return function(){if(r("seq_error")||r("seq_aborted")||0===arguments.length)return e;var u=t.call(arguments);return e.then(function(e){function r(){var n;l===u.length&&(n=[],s?(u.forEach(function(t,a){n.push(o["s"+a])}),e.fail.apply(a,n)):(u.forEach(function(t,a){n.push(c["s"+a])}),e.apply(a,n)))}var s=!1,l=0,o={},c={},p=n.apply(a,t.call(arguments,1));u=u.map(function(u,p){return function(f){var i=t.call(arguments);i[0]=function(){s=!0,l++,o["s"+p]=arguments.length>1?n.messages.apply(a,arguments):arguments[0],r()},i[0].fail=function(){l++,c["s"+p]=arguments.length>1?n.messages.apply(a,arguments):arguments[0],r()},i[0].abort=function(){s||(f.abort(),e.abort())},u.apply(a,i)}}),p.gate.apply(a,u)}),e}}),n.extend("try",function(e,r){return function(){if(r("seq_error")||r("seq_aborted")||0===arguments.length)return e;var u=t.call(arguments).map(function(e){return function(r){var u=t.call(arguments),s=n.apply(a,u.slice(1));s.then(function(){e.apply(a,arguments)}).val(function(){r.apply(a,arguments)}).or(function(){var t=n.messages.apply(a,arguments);r({"catch":t.length>1?t:t[0]})})}});return e.then.apply(a,u),e}}),n.extend("until",function(e,r){return function(){if(r("seq_error")||r("seq_aborted")||0===arguments.length)return e;var u=t.call(arguments).map(function(e){return function r(u){var s=t.call(arguments),l=n.apply(a,s.slice(1));l.then(function(){var n=t.call(arguments);n[0].break=function(){u.fail.apply(a,arguments),l.abort()},e.apply(a,n)}).val(function(){u.apply(a,arguments)}).or(function(){r.apply(a,s)})}});return e.then.apply(a,u),e}}),{}});

@@ -33,2 +33,3 @@ #!/usr/bin/env node

exec = require("child_process").exec,
ugly = require("uglify-js"),

@@ -67,7 +68,22 @@ bundle_str = "",

exec("node_modules/.bin/uglifyjs contrib.src.js --comments '/^\!/' --mangle --compress --output contrib.js",function(){
// ensure trailing new-line
fs.appendFileSync(path.join(__dirname,"..","contrib.js"),"\n");
try {
result = ugly.minify(path.join(__dirname,"..","contrib.src.js"),{
mangle: true,
compress: true,
output: {
comments: /^!/
}
});
fs.writeFileSync(
path.join(__dirname,"..","contrib.js"),
result.code + "\n",
{ encoding: "utf8" }
);
console.log("Complete.");
});
}
catch (err) {
console.error(err);
process.exit(1);
}
/*! asynquence
v0.2.0-a (c) Kyle Simpson
v0.2.0-c (c) Kyle Simpson
MIT License: http://getify.mit-license.org

@@ -4,0 +4,0 @@ */

@@ -30,1 +30,15 @@ # asynquence Contrib

```
## Building Contrib Bundle
There is a utility provided to bundle the contrib plugins and build the un-minified and minified files from the bundle.
`contrib/bundle.js` builds `contrib.src.js` (in the package root), and then builds (minifies) `contrib.js` (in the package root). The recommended way to invoke this utility is via npm:
`npm run-script bundle-contrib`
By default, the build includes all the `contrib/plugin.*` plugins. You can manually specify which plugins you want, like this:
`contrib/bundle.js any none try` (which would bundle only `any`, `none`, and `try` plugins)
**Note:** `npm run-script ..` [doesn't *currently*](https://github.com/isaacs/npm/issues/3494) support passing the extra command line params, so you must use `contrib/bundle.js` instead of `npm run-script bundle-contrib` if you want to pick which plugins to bundle.
{
"name": "asynquence",
"version": "0.2.0-b",
"version": "0.2.0-c",
"description": "asynquence: async sequences & gates for flow-control",

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

@@ -237,2 +237,20 @@ # asynquence

## Builds
There are two utilities included which you can use to build the files.
* `./build-core.js` builds (minifies) the `asq.js` file (in the package root). The recommended way to invoke this utility is via npm:
`npm run-script build-core`
* `contrib/bundle.js` builds `contrib.src.js` (in the package root), and then builds (minifies) `contrib.js` (in the package root). The recommended way to invoke this utility is via npm:
`npm run-script bundle-contrib`
By default, the build includes all the `contrib/plugin.*` plugins. You can manually specify which plugins you want, like this:
`contrib/bundle.js any none try` (which would bundle only `any`, `none`, and `try` plugins)
**Note:** `npm run-script ..` [doesn't *currently*](https://github.com/isaacs/npm/issues/3494) support passing the extra command line params, so you must use `contrib/bundle.js` instead of `npm run-script bundle-contrib` if you want to pick which plugins to bundle.
## License

@@ -239,0 +257,0 @@

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