Socket
Socket
Sign inDemoInstall

effects-as-data

Package Overview
Dependencies
Maintainers
1
Versions
155
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

effects-as-data - npm Package Compare versions

Comparing version 1.5.2 to 1.5.4

3

lib/demo/error-handling.spec.js

@@ -7,3 +7,2 @@ 'use strict';

run = _require.run,
failure = _require.failure,
success = _require.success;

@@ -41,3 +40,3 @@

function testHandler(action) {
return failure(error);
throw error;
}

@@ -44,0 +43,0 @@

@@ -24,6 +24,10 @@ 'use strict';

var value = void 0;
if (typeof plugin === 'function') {
value = plugin(a);
} else {
value = plugin;
try {
if (typeof plugin === 'function') {
value = plugin(a);
} else {
value = plugin;
}
} catch (e) {
value = normalizeToFailure(e);
}

@@ -30,0 +34,0 @@ return toPromise(value).catch(normalizeToFailure);

@@ -276,3 +276,3 @@ 'use strict';

it('should handle promise rejections and return a failure object', function _callee10() {
it('should handle promise rejections and normalize to a failure', function _callee10() {
var a, error, handlers, run, results;

@@ -311,4 +311,41 @@ return regeneratorRuntime.async(function _callee10$(_context10) {

});
it('should handle thrown errors and normalize to a failure', function _callee11() {
var a, error, handlers, run, results;
return regeneratorRuntime.async(function _callee11$(_context11) {
while (1) {
switch (_context11.prev = _context11.next) {
case 0:
a = {
type: 'test'
};
error = new Error('nope');
handlers = {
test: function test() {
throw error;
}
};
run = function run() {};
_context11.next = 6;
return regeneratorRuntime.awrap(handleActions(run, handlers, [a]));
case 6:
results = _context11.sent;
deepEqual(results, [{
success: false,
error: error
}]);
case 8:
case 'end':
return _context11.stop();
}
}
}, null, undefined);
});
});
});
//# sourceMappingURL=handle-actions.spec.js.map
{
"name": "effects-as-data",
"version": "1.5.2",
"version": "1.5.4",
"description": "Express async workflows using pure functions.",

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

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

const { run, failure, success } = require('../index')
const { run, success } = require('../index')
const { deepEqual } = require('assert')

@@ -16,3 +16,3 @@

function testHandler (action) {
return failure(error)
throw error
}

@@ -19,0 +19,0 @@

@@ -23,6 +23,10 @@ const {

let value
if (typeof plugin === 'function') {
value = plugin(a)
} else {
value = plugin
try {
if (typeof plugin === 'function') {
value = plugin(a)
} else {
value = plugin
}
} catch (e) {
value = normalizeToFailure(e)
}

@@ -29,0 +33,0 @@ return toPromise(value).catch(normalizeToFailure)

@@ -110,3 +110,3 @@ const { handleActions } = require('./handle-actions')

it('should handle promise rejections and return a failure object', async () => {
it('should handle promise rejections and normalize to a failure', async () => {
const a = {

@@ -126,3 +126,21 @@ type: 'test'

})
it('should handle thrown errors and normalize to a failure', async () => {
const a = {
type: 'test'
}
const error = new Error('nope')
const handlers = {
test: () => {
throw error
}
}
const run = () => {}
let results = await handleActions(run, handlers, [a])
deepEqual(results, [{
success: false,
error
}])
})
})
})

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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