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

horpyna

Package Overview
Dependencies
Maintainers
1
Versions
80
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

horpyna - npm Package Compare versions

Comparing version 4.4.0 to 4.4.1

15

dist/index.js

@@ -177,8 +177,13 @@ (function webpackUniversalModuleDefinition(root, factory) {

value: function execute(value) {
var _this2 = this;
if (this.condition(value)) {
var actionResult = this.action(value);
return _bluebird2.default.reduce(this.branches, function (result, branch) {
return result !== null ? _bluebird2.default.resolve(result) : branch.execute(actionResult);
}, null).then(function (childBranchResult) {
return childBranchResult || actionResult;
return _bluebird2.default.resolve().then(function () {
return _this2.action(value);
}).then(function (actionResult) {
return _bluebird2.default.reduce(_this2.branches, function (result, branch) {
return result !== null ? _bluebird2.default.resolve(result) : branch.execute(actionResult);
}, null).then(function (childBranchResult) {
return childBranchResult || actionResult;
});
});

@@ -185,0 +190,0 @@ }

{
"name": "horpyna",
"version": "4.4.0",
"version": "4.4.1",
"description": "utility to manage async processes",

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

@@ -48,8 +48,11 @@ import { convertToBranches, convertToBranch } from "./convertToBranches";

if (this.condition(value)) {
const actionResult = this.action(value);
return Promise.reduce(
this.branches,
(result, branch) => (result !== null ? Promise.resolve(result) : branch.execute(actionResult)),
null
).then(childBranchResult => childBranchResult || actionResult);
return Promise.resolve()
.then(() => this.action(value))
.then(actionResult =>
Promise.reduce(
this.branches,
(result, branch) => (result !== null ? Promise.resolve(result) : branch.execute(actionResult)),
null
).then(childBranchResult => childBranchResult || actionResult)
);
}

@@ -56,0 +59,0 @@ return Promise.resolve(null);

/* eslint-disable no-unused-vars, no-new */
import Branch from "./Branch";
import Promise from "bluebird";

@@ -43,2 +44,13 @@ describe("Branch", () => {

});
describe("when branch action returns promise", () => {
it("should return value", () => {
const mainBranch = new Branch({
name: "mainBranch",
action: value => Promise.resolve(value + 1),
branches: [{ name: "otherSubBranch", action: value => value + 1 }]
});
return mainBranch.execute(10).then(value => expect(value).to.be.equal(12));
});
});
describe("when conditions not met", () => {

@@ -45,0 +57,0 @@ describe("when no child branches", () => {

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