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

switchback

Package Overview
Dependencies
Maintainers
6
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

switchback - npm Package Compare versions

Comparing version 1.1.3 to 2.0.0

14

lib/factory.js

@@ -44,3 +44,13 @@ /**

if (_.isObject(err) && _.isString(err.exit) && _.isFunction(_switch[err.exit])) {
return _switch[err.exit].apply(callbackContext || this, args);
// Also, if we're able to do this (i.e. a callback was supplied for this "exit")
// then check to see if there was also an `.output` property provided.
// If so, use it as the first argument when triggering the callback.
if (!_.isUndefined(err.output)) {
return _switch[err.exit].apply(callbackContext || this, [err.output]);
}
// Otherwise, just use the err object as-is.
// (TODO: in `machine`, consider using the description, other metadata, etc.)
else {
return _switch[err.exit].apply(callbackContext || this, args);
}
}

@@ -56,3 +66,3 @@ return _switch.error.apply(callbackContext || this, args);

// Mix in non-enumerable `.inspect()` method
Object.defineProperty(this, 'inspect', { enumerable: false, writable: true });
Object.defineProperty(_switch, 'inspect', { enumerable: false, writable: true });
_switch.inspect = function () { return '[Switchback]'; };

@@ -59,0 +69,0 @@

@@ -110,2 +110,5 @@ /**

// This is here as a failsafe to solve issues when no error callback is specified.
var MAX_WILDCARD_FWDS = 15;
var numWildcardFwds = 0;

@@ -140,2 +143,8 @@ // Supply a handful of default handlers to provide better error messages.

// Before attempting to call error handler, ensure that we're not
// in an infinite loop.
if (numWildcardFwds > MAX_WILDCARD_FWDS) {
throw new Error('Switchback: handlers object (' + util.inspect(defaultHandlers) + ') has a cyclic redirect.');
}
// If a callback fn exists under the '*' or 'error' key in default handlers, call it

@@ -142,0 +151,0 @@ if (_.isObject(defaultHandlers)){

2

package.json
{
"name": "switchback",
"version": "1.1.3",
"version": "2.0.0",
"description": "Normalize callback fns to switchbacks and vice versa",

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