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

levee

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

levee - npm Package Compare versions

Comparing version 1.0.3 to 1.1.0

33

lib/breaker.js

@@ -38,15 +38,20 @@ 'use strict';

Breaker.prototype.run = function run(context, callback) {
var self, fallback, fn;
Breaker.prototype.run = function run(/*args...n, callback*/) {
var args, self, fallback, orig;
args = Array.prototype.slice.call(arguments);
self = this;
fallback = this.fallback;
fn = callback;
if (fallback instanceof Breaker) {
fn = function wrapper(err/*, ...data*/) {
orig = args.slice();
args[args.length - 1] = function wrapper(err/*, ...data*/) {
var callback;
if (err && self.isOpen()) {
fallback.run(context, callback);
fallback.run.apply(fallback, orig);
return;
}
callback = orig.pop();
callback.apply(null, arguments);

@@ -56,11 +61,14 @@ };

this._run(context, fn);
this._run.apply(this, args);
};
Breaker.prototype._run = function _run(context, callback) {
var self, start, timer, execute;
Breaker.prototype._run = function _run(/*args...n, callback*/) {
var args, callback, self, start, timer, execute;
this.emit('execute');
args = Array.prototype.slice.call(arguments);
callback = args.pop();
if (this.isOpen() || this._pendingClose) {

@@ -97,4 +105,3 @@ this.emit('reject');

execute = Zalgo.contain(this._impl.execute, this._impl);
execute(context, function onreponse(err/*, ...data*/) {
args[args.length] = function onreponse(err/*, ...data*/) {
if (!timer) { return; }

@@ -117,3 +124,7 @@

callback.apply(null, arguments);
});
};
execute = Zalgo.contain(this._impl.execute, this._impl);
execute.apply(null, args);
};

@@ -120,0 +131,0 @@

{
"name": "levee",
"version": "1.0.3",
"version": "1.1.0",
"description": "A circuitbreaker implementation for Node.js",

@@ -5,0 +5,0 @@ "main": "index.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