Comparing version 1.0.0 to 1.0.1
@@ -95,6 +95,10 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
_ref$childBranchList = _ref.childBranchList, | ||
childBranchList = _ref$childBranchList === undefined ? [] : _ref$childBranchList; | ||
childBranchList = _ref$childBranchList === undefined ? [] : _ref$childBranchList, | ||
debug = _ref.debug; | ||
debug("create 'setValue' method"); | ||
return function (value) { | ||
debug("call 'setValue' function"); | ||
if (conditionFunction(value)) { | ||
debug("conditions met"); | ||
var doFunctionResult = doFunction ? doFunction(value) : value; | ||
@@ -160,4 +164,8 @@ var childBranchResult = getFirstChildBranchResult(childBranchList, doFunctionResult); | ||
var _createWhenAction = __webpack_require__(5); | ||
var _debug = __webpack_require__(5); | ||
var _debug2 = _interopRequireDefault(_debug); | ||
var _createWhenAction = __webpack_require__(6); | ||
var _createWhenAction2 = _interopRequireDefault(_createWhenAction); | ||
@@ -168,3 +176,7 @@ | ||
exports.default = { | ||
when: (0, _createWhenAction2.default)() | ||
when: function when() { | ||
var debug = (0, _debug2.default)("Horpyna"); | ||
debug("initialize instance"); | ||
return (0, _createWhenAction2.default)({ debug: debug }).apply(undefined, arguments); | ||
} | ||
}; | ||
@@ -174,2 +186,8 @@ | ||
/* 5 */ | ||
/***/ (function(module, exports) { | ||
module.exports = require("debug"); | ||
/***/ }), | ||
/* 6 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
@@ -185,3 +203,3 @@ | ||
var _createDoAction = __webpack_require__(6); | ||
var _createDoAction = __webpack_require__(7); | ||
@@ -192,6 +210,10 @@ var _createDoAction2 = _interopRequireDefault(_createDoAction); | ||
function createWhenAction() { | ||
function createWhenAction(_ref) { | ||
var debug = _ref.debug; | ||
debug("create 'when' method"); | ||
return function (conditionFunction) { | ||
debug("call 'when' function"); | ||
return { | ||
do: (0, _createDoAction2.default)({ conditionFunction: conditionFunction }) | ||
do: (0, _createDoAction2.default)({ conditionFunction: conditionFunction, debug: debug }) | ||
}; | ||
@@ -202,3 +224,3 @@ }; | ||
/***/ }), | ||
/* 6 */ | ||
/* 7 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
@@ -218,3 +240,3 @@ | ||
var _createAddBranchAction = __webpack_require__(7); | ||
var _createAddBranchAction = __webpack_require__(8); | ||
@@ -226,8 +248,11 @@ var _createAddBranchAction2 = _interopRequireDefault(_createAddBranchAction); | ||
function createDoAction(_ref) { | ||
var conditionFunction = _ref.conditionFunction; | ||
var conditionFunction = _ref.conditionFunction, | ||
debug = _ref.debug; | ||
debug("create 'do' method"); | ||
return function (doFunction) { | ||
debug("call 'do' function"); | ||
return { | ||
setValue: (0, _createSetValueAction2.default)({ doFunction: doFunction, conditionFunction: conditionFunction }), | ||
addBranch: (0, _createAddBranchAction2.default)({ doFunction: doFunction, conditionFunction: conditionFunction }) | ||
setValue: (0, _createSetValueAction2.default)({ doFunction: doFunction, conditionFunction: conditionFunction, debug: debug }), | ||
addBranch: (0, _createAddBranchAction2.default)({ doFunction: doFunction, conditionFunction: conditionFunction, debug: debug }) | ||
}; | ||
@@ -238,3 +263,3 @@ }; | ||
/***/ }), | ||
/* 7 */ | ||
/* 8 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
@@ -260,9 +285,12 @@ | ||
_ref$childBranchList = _ref.childBranchList, | ||
childBranchList = _ref$childBranchList === undefined ? [] : _ref$childBranchList; | ||
childBranchList = _ref$childBranchList === undefined ? [] : _ref$childBranchList, | ||
debug = _ref.debug; | ||
debug("create 'addBranch' method"); | ||
return function (childBranch) { | ||
debug("call 'addBranch' function"); | ||
childBranchList = childBranchList.concat(childBranch); | ||
return { | ||
addBranch: createAddBranchAction({ doFunction: doFunction, conditionFunction: conditionFunction, childBranchList: childBranchList }), | ||
setValue: (0, _createSetValueAction2.default)({ doFunction: doFunction, conditionFunction: conditionFunction, childBranchList: childBranchList }) | ||
addBranch: createAddBranchAction({ doFunction: doFunction, conditionFunction: conditionFunction, childBranchList: childBranchList, debug: debug }), | ||
setValue: (0, _createSetValueAction2.default)({ doFunction: doFunction, conditionFunction: conditionFunction, childBranchList: childBranchList, debug: debug }) | ||
}; | ||
@@ -269,0 +297,0 @@ }; |
{ | ||
"name": "horpyna", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "utility to manage async processes", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -11,2 +11,10 @@ # HORPYNA | ||
## Debugger | ||
For easy debug this library run your script with | ||
``` | ||
DEBUG=Horpyna <command to run> | ||
``` | ||
## LICENSE | ||
@@ -13,0 +21,0 @@ |
import createSetValueAction from "./createSetValueAction"; | ||
export default function createAddBranchAction({ doFunction, conditionFunction, childBranchList = [] }) { | ||
export default function createAddBranchAction({ doFunction, conditionFunction, childBranchList = [], debug }) { | ||
debug("create 'addBranch' method"); | ||
return childBranch => { | ||
debug("call 'addBranch' function"); | ||
childBranchList = childBranchList.concat(childBranch); | ||
return { | ||
addBranch: createAddBranchAction({ doFunction, conditionFunction, childBranchList }), | ||
setValue: createSetValueAction({ doFunction, conditionFunction, childBranchList }) | ||
addBranch: createAddBranchAction({ doFunction, conditionFunction, childBranchList, debug }), | ||
setValue: createSetValueAction({ doFunction, conditionFunction, childBranchList, debug }) | ||
}; | ||
}; | ||
} |
import createSetValueAction from "./createSetValueAction"; | ||
import createAddBranchAction from "./createAddBranchAction"; | ||
export default function createDoAction({ conditionFunction }) { | ||
export default function createDoAction({ conditionFunction, debug }) { | ||
debug("create 'do' method"); | ||
return doFunction => { | ||
debug("call 'do' function"); | ||
return { | ||
setValue: createSetValueAction({ doFunction, conditionFunction }), | ||
addBranch: createAddBranchAction({ doFunction, conditionFunction }) | ||
setValue: createSetValueAction({ doFunction, conditionFunction, debug }), | ||
addBranch: createAddBranchAction({ doFunction, conditionFunction, debug }) | ||
}; | ||
}; | ||
} |
export default function createSetValueAction({ | ||
doFunction = null, | ||
conditionFunction = () => true, | ||
childBranchList = [] | ||
childBranchList = [], | ||
debug | ||
}) { | ||
debug("create 'setValue' method"); | ||
return value => { | ||
debug("call 'setValue' function"); | ||
if (conditionFunction(value)) { | ||
debug("conditions met"); | ||
const doFunctionResult = doFunction ? doFunction(value) : value; | ||
@@ -9,0 +13,0 @@ const childBranchResult = getFirstChildBranchResult(childBranchList, doFunctionResult); |
import createDoAction from "./createDoAction"; | ||
export default function createWhenAction() { | ||
export default function createWhenAction({ debug }) { | ||
debug("create 'when' method"); | ||
return conditionFunction => { | ||
debug("call 'when' function"); | ||
return { | ||
do: createDoAction({ conditionFunction }) | ||
do: createDoAction({ conditionFunction, debug }) | ||
}; | ||
}; | ||
} |
@@ -0,4 +1,9 @@ | ||
import createDebug from "debug"; | ||
import createWhenAction from "./actions/createWhenAction"; | ||
export default { | ||
when: createWhenAction() | ||
when() { | ||
let debug = createDebug("Horpyna"); | ||
debug("initialize instance"); | ||
return createWhenAction({ debug })(...arguments); | ||
} | ||
}; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
64242
396
25
0