New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

breeze

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

breeze - npm Package Compare versions

Comparing version 0.2.3 to 0.3.0

51

breeze.js

@@ -15,3 +15,3 @@ /*!

/*!
3/*!
* Breeze Async Control Utility

@@ -39,3 +39,3 @@ * Copyright(c) 2012 Jake Luer <jake@alogicalparadox.com>

exports.version = '0.2.3';
exports.version = '0.3.0';

@@ -259,2 +259,49 @@ /**

/**
* ### .atomic ()
*
* Provides atomic functions. Each serial set is
* placed in a queue based on a key. All functions within
* a single key are executed serially. Useful if you are
* trying to perform asyncronous operations as a series but
* with multiple data structures.
*
* var atomic = breeze.atomic();
* for (var i = 0; i < 5; i++) {
* atomic('i', function (done, key, n) {
* // key == 'i';
* // n == current i
* done();
* }, i);
* });
*
* @name atomic
* @api public
*/
exports.atomic = function () {
var handler = {};
function iterator (task, next) {
task.args.unshift(function () {
next();
}, task.key);
task.fn.apply(this, task.args);
}
function makeQueue (key) {
var queue = exports.queue(iterator, 1);
queue.drain = function () {
delete handler[key];
};
return queue;
}
return function atomic (key, fn) {
var task = { key: key, fn: fn, args: slice.call(arguments, 2) }
, list = handler[key] || (handler[key] = makeQueue(key));
list.push(task, null, true);
};
};
/**
* ### queue (iterator, concurrency)

@@ -261,0 +308,0 @@ *

2

breeze.min.js

@@ -7,2 +7,2 @@ /*!

!function(a,b){typeof module!="undefined"?module.exports=b():typeof define=="function"&&typeof define.amd=="object"?define(b):this[a]=b()}("breeze",function(){function e(a){return a.length===0?null:a.length===1?a[0]:a}function f(a){if(Array.isArray(a)){var b=[];for(var c=0,d=a.length;c<d;c++)b.push(c);return b}return Object.keys(a)}function g(a,b,d){return function(b,f){var g=a[b];g(function(){var g=arguments[0];if(g)return f(g);var h=c.call(arguments,1),i=e(h);d[b]=i,f()})}}function h(a,b){this._iterator=a,this._concurrency=b||10,this._tasks=[],this._err=!1,this.workers=0}function i(a){function e(a){this.id=a,this.notify=[],this.waitfor=[]}function f(a,e){var g=b[a],h=g.id;if(d[a])return;Array.isArray(e)||(e=[]),e.push(h),d[a]=!0,g.notify.forEach(function(a){if(e.indexOf(a)>=0)throw new Error(h+" can not come before "+a);var b=a.toString(),c=e.map(function(a){return a});f(b,c)}),c.unshift(h)}function g(a){return null!==a&&"undefined"!=typeof a}var b={},c=[],d={};a.forEach(function(a){var c=a[0],d=a[1];b[c]||(b[c]=new e(c)),b[d]||(b[d]=new e(d)),~b[d].waitfor.indexOf(c)||b[d].waitfor.push(c),~b[c].notify.indexOf(d)||b[c].notify.push(d)});try{Object.keys(b).forEach(f)}catch(h){return{error:h}}var i=c.filter(g),j=[];return i.forEach(function(a){var c=b[a];c.notify=c.notify.filter(g),c.waitfor=c.waitfor.filter(g),j.push(c)}),{path:i,graph:j}}var a={},b=function(){},c=Array.prototype.slice,d=a.exports={};return d.version="0.2.3",d.nextTick="undefined"==typeof process||!process.nextTick?function(a){setTimeout(a,0)}:process.nextTick,d.forEach=function(a,c,d){d=d||b;if(!a.length)return d();var e=a.length;for(var f=0,g=a.length;f<g;f++)c(a[f],function(b){if(b)return d(b);--e||d(null)})},d.forEachSeries=function(a,c,d){function e(b){if(b==a.length)return d();c(a[b],function(c){if(c)return d(c);e(++b)})}d=d||b;if(!a.length)return d();e(0)},d.parallel=function(a,c){c=c||b;var e=f(a),h=Array.isArray(a)?Array(a.length):{},i=g(a,e,h);if(!e.length)return c();d.forEach(e,i,function(a){if(a)return c(a);c(null,h)})},d.series=function(a,c){c=c||b;var e=f(a),h=Array.isArray(a)?Array(a.length):{},i=g(a,e,h);if(!e.length)return c();d.forEachSeries(e,i,function(a){if(a)return c(a);c(null,h)})},d.queue=function(a,b){var c=new h(a,b);return c},Object.defineProperty(h.prototype,"length",{get:function(){return this._tasks.length}}),h.prototype.push=function(a,c,e){c=c||b,Array.isArray(a)||(a=[a]);var f=this._concurrency,g=this.saturated;for(var h=0,i=a.length;h<i;h++){var j=a[h];this._tasks.push({task:j,cb:c}),g&&this._tasks.length===f&&g(),e&&d.nextTick(this.process.bind(this))}},h.prototype.process=function(){var a=this,b=this._concurrency,c=this._iterator;if(this.workers<b&&this.length&&!this._err){var d=this._tasks.shift();this.empty&&!this.length&&this.empty(),this.workers++,c(d.task,function(){a.workers--;if(a._err)return;var c=arguments[0];c&&(a._err=!0),d.cb&&d.cb.apply(d,arguments);if(c&&a.onerror)return a.onerror(c);a.drain&&a.length+a.workers===0&&a.drain(),a.process()}),this.process()}},h.prototype.onerror=null,h.prototype.saturated=null,h.prototype.empty=null,h.prototype.drain=null,d.dag=function(a,c,d,e){function g(a){return l.filter(function(b){return b.id===a})[0]}function j(a,b){d(a,function(d){var e=g(a);e.notify.forEach(function(b){var c=g(b);c.fulfilled.push(a);var d=c.waitfor.length,e=c.fulfilled.length;d===e&&m.push(b,null,!0)}),b(d)})}function k(a){a.fulfilled=[],a.waitfor.length||m.push(a.id)}e=e||b;var f=i(a);if(f.error)return e(f.error);if(!f.path.length)return e(null);var l=f.graph,m=new h(j,c);l.forEach(k),m.onerror=e,m.drain=e,m.process()},d.dagSeries=function(a,c,e){e=e||b;var f=i(a);if(f.error)return e(f.error);d.forEachSeries(f.path,function(a,b){c(a,b)},e)},a.exports})
!function(a,b){typeof module!="undefined"?module.exports=b():typeof define=="function"&&typeof define.amd=="object"?define(b):this[a]=b()}("breeze",function(){function e(a){return a.length===0?null:a.length===1?a[0]:a}function f(a){if(Array.isArray(a)){var b=[];for(var c=0,d=a.length;c<d;c++)b.push(c);return b}return Object.keys(a)}function g(a,b,d){return function(b,f){var g=a[b];g(function(){var g=arguments[0];if(g)return f(g);var h=c.call(arguments,1),i=e(h);d[b]=i,f()})}}function h(a,b){this._iterator=a,this._concurrency=b||10,this._tasks=[],this._err=!1,this.workers=0}function i(a){function e(a){this.id=a,this.notify=[],this.waitfor=[]}function f(a,e){var g=b[a],h=g.id;if(d[a])return;Array.isArray(e)||(e=[]),e.push(h),d[a]=!0,g.notify.forEach(function(a){if(e.indexOf(a)>=0)throw new Error(h+" can not come before "+a);var b=a.toString(),c=e.map(function(a){return a});f(b,c)}),c.unshift(h)}function g(a){return null!==a&&"undefined"!=typeof a}var b={},c=[],d={};a.forEach(function(a){var c=a[0],d=a[1];b[c]||(b[c]=new e(c)),b[d]||(b[d]=new e(d)),~b[d].waitfor.indexOf(c)||b[d].waitfor.push(c),~b[c].notify.indexOf(d)||b[c].notify.push(d)});try{Object.keys(b).forEach(f)}catch(h){return{error:h}}var i=c.filter(g),j=[];return i.forEach(function(a){var c=b[a];c.notify=c.notify.filter(g),c.waitfor=c.waitfor.filter(g),j.push(c)}),{path:i,graph:j}}var a={};3;var b=function(){},c=Array.prototype.slice,d=a.exports={};return d.version="0.3.0",d.nextTick="undefined"==typeof process||!process.nextTick?function(a){setTimeout(a,0)}:process.nextTick,d.forEach=function(a,c,d){d=d||b;if(!a.length)return d();var e=a.length;for(var f=0,g=a.length;f<g;f++)c(a[f],function(b){if(b)return d(b);--e||d(null)})},d.forEachSeries=function(a,c,d){function e(b){if(b==a.length)return d();c(a[b],function(c){if(c)return d(c);e(++b)})}d=d||b;if(!a.length)return d();e(0)},d.parallel=function(a,c){c=c||b;var e=f(a),h=Array.isArray(a)?Array(a.length):{},i=g(a,e,h);if(!e.length)return c();d.forEach(e,i,function(a){if(a)return c(a);c(null,h)})},d.series=function(a,c){c=c||b;var e=f(a),h=Array.isArray(a)?Array(a.length):{},i=g(a,e,h);if(!e.length)return c();d.forEachSeries(e,i,function(a){if(a)return c(a);c(null,h)})},d.atomic=function(){function b(a,b){a.args.unshift(function(){b()},a.key),a.fn.apply(this,a.args)}function e(c){var e=d.queue(b,1);return e.drain=function(){delete a[c]},e}var a={};return function(d,f){var g={key:d,fn:f,args:c.call(arguments,2)},h=a[d]||(a[d]=e(d));h.push(g,null,!0)}},d.queue=function(a,b){var c=new h(a,b);return c},Object.defineProperty(h.prototype,"length",{get:function(){return this._tasks.length}}),h.prototype.push=function(a,c,e){c=c||b,Array.isArray(a)||(a=[a]);var f=this._concurrency,g=this.saturated;for(var h=0,i=a.length;h<i;h++){var j=a[h];this._tasks.push({task:j,cb:c}),g&&this._tasks.length===f&&g(),e&&d.nextTick(this.process.bind(this))}},h.prototype.process=function(){var a=this,b=this._concurrency,c=this._iterator;if(this.workers<b&&this.length&&!this._err){var d=this._tasks.shift();this.empty&&!this.length&&this.empty(),this.workers++,c(d.task,function(){a.workers--;if(a._err)return;var c=arguments[0];c&&(a._err=!0),d.cb&&d.cb.apply(d,arguments);if(c&&a.onerror)return a.onerror(c);a.drain&&a.length+a.workers===0&&a.drain(),a.process()}),this.process()}},h.prototype.onerror=null,h.prototype.saturated=null,h.prototype.empty=null,h.prototype.drain=null,d.dag=function(a,c,d,e){function g(a){return l.filter(function(b){return b.id===a})[0]}function j(a,b){d(a,function(d){var e=g(a);e.notify.forEach(function(b){var c=g(b);c.fulfilled.push(a);var d=c.waitfor.length,e=c.fulfilled.length;d===e&&m.push(b,null,!0)}),b(d)})}function k(a){a.fulfilled=[],a.waitfor.length||m.push(a.id)}e=e||b;var f=i(a);if(f.error)return e(f.error);if(!f.path.length)return e(null);var l=f.graph,m=new h(j,c);l.forEach(k),m.onerror=e,m.drain=e,m.process()},d.dagSeries=function(a,c,e){e=e||b;var f=i(a);if(f.error)return e(f.error);d.forEachSeries(f.path,function(a,b){c(a,b)},e)},a.exports})
0.3.0 / 2012-06-28
==================
* add `atomic` method
0.2.3 / 2012-06-18

@@ -3,0 +8,0 @@ ==================

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

/*!
3/*!
* Breeze Async Control Utility

@@ -24,3 +24,3 @@ * Copyright(c) 2012 Jake Luer <jake@alogicalparadox.com>

exports.version = '0.2.3';
exports.version = '0.3.0';

@@ -244,2 +244,49 @@ /**

/**
* ### .atomic ()
*
* Provides atomic functions. Each serial set is
* placed in a queue based on a key. All functions within
* a single key are executed serially. Useful if you are
* trying to perform asyncronous operations as a series but
* with multiple data structures.
*
* var atomic = breeze.atomic();
* for (var i = 0; i < 5; i++) {
* atomic('i', function (done, key, n) {
* // key == 'i';
* // n == current i
* done();
* }, i);
* });
*
* @name atomic
* @api public
*/
exports.atomic = function () {
var handler = {};
function iterator (task, next) {
task.args.unshift(function () {
next();
}, task.key);
task.fn.apply(this, task.args);
}
function makeQueue (key) {
var queue = exports.queue(iterator, 1);
queue.drain = function () {
delete handler[key];
};
return queue;
}
return function atomic (key, fn) {
var task = { key: key, fn: fn, args: slice.call(arguments, 2) }
, list = handler[key] || (handler[key] = makeQueue(key));
list.push(task, null, true);
};
};
/**
* ### queue (iterator, concurrency)

@@ -246,0 +293,0 @@ *

@@ -5,3 +5,3 @@ {

"description": "Async flow control utility.",
"version": "0.2.3",
"version": "0.3.0",
"repository": {

@@ -8,0 +8,0 @@ "type": "git",

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