{"_id":"@alumna/unitflow","_rev":"7-e4ec2a311792d57441a082b071addff1","name":"@alumna/unitflow","dist-tags":{"latest":"1.0.3"},"versions":{"0.9.0":{"name":"@alumna/unitflow","version":"0.9.0","description":"Organize your library or project, defining flows composable by a sequence of units","main":"dist/unitflow.cjs.js","module":"dist/unitflow.es.js","scripts":{"build":"rollup --config rollup/cjs.js && rollup --config rollup/es.js","prepare":"npm run build","test":"jest --coverage"},"repository":{"type":"git","url":"git+https://github.com/alumna/unitflow.git"},"author":{"name":"Paulo Coghi"},"license":"MIT","bugs":{"url":"https://github.com/alumna/unitflow/issues"},"homepage":"https://github.com/alumna/unitflow#readme","jest":{"coverageDirectory":"./coverage/","collectCoverage":true,"collectCoverageFrom":["**/src/**","!**/dist/**","!**/rollup/**","!**/node_modules/**"],"verbose":true,"testEnvironment":"node"},"babel":{"env":{"test":{"plugins":["@babel/plugin-transform-modules-commonjs"]}}},"devDependencies":{"@babel/plugin-transform-modules-commonjs":"^7.8.3","jest":"^25.1.0","rollup":"^1.32.0","rollup-plugin-terser":"^5.2.0"},"gitHead":"29880e07468704a2cca5d860b3b7f2f604d4712f","_id":"@alumna/unitflow@0.9.0","_nodeVersion":"12.16.1","_npmVersion":"6.14.1","dist":{"integrity":"sha512-/+uyoSE7PUJ+/dhb/4gojbnyDcdkETNf/v2oNdNRGDmOoJnWDiPKbZoPDRXILtl+yQztuILyITeLsTNRt1q2sA==","shasum":"0a8cf72428045a3ed0ca741ed1791b4973902c0e","tarball":"https://registry.npmjs.org/@alumna/unitflow/-/unitflow-0.9.0.tgz","fileCount":7,"unpackedSize":8597,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeWYd5CRA9TVsSAnZWagAADwMP/jlljOTXCa58VHEQVaZ6\nqOv39ze5+0e3z/dGx3J4PMc4FsSNZm22UkOmkGCvC59la9eOHee7mL4y6ueL\nelAJaM6rz6/hdOYhZwpE7TgFMg7ikBjwF298OQvByggh2/h/S6LkpG4RHrtL\n25Zyp/r4L7G7gzK6NijucgHm3JRqI56iI6v7pt3zEa1dbKL4GBLepa7jIvz5\nDoOzuzyMu3r6w1cOwm8sa3ld5l7CjXkLxgLkxJtDmmPDeLvNToCeicuNK+eh\n9G4XLae6FBccTkMEm/lEbE1SsJX8KzsOFCQJ/k3z3Sc8erwL2DeFvhS9RvhK\nbQVxCVZKzSo4RBCdFL87YBp15C4gY943ZN5nfcd3pIbh0guUkLVrAOTjQBa+\nU4uzQ1oXKxY4+lMug5GIRh2MajlO7v6oEzcyT5mGDPyHc609q5wZY0bIw7ni\nriQYR90vHjHyU/FMH1fhATwMRCTLLa5CiMsc4lVirc0gLnq931rVs+xym/Tb\nr6nX/ATZHuLO2bWDnTcZx4g4IBahFCZrUdjbV1j0K6pdaMxu4P1dAV373otd\nPLi1vV4EP4JbTZnlUauLdqI4p6lKfdJVpRVCaknwB6k0Bh7EB6e6Jt1C0fZF\n6hrRBa26YnZ0V8IMWoGIZeaTjpfJfepLKksfN583+B+4DdsCH2ZSF+462hzo\nbLKB\r\n=mDRX\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCIdgOLH11pylkrfF5oMvuh0HYrb2o4UMlt+JtvSTBhTgIgbIJSiHtyZnIgR/dkAqjJSL4SKZxkogWQxnGcPv8arnA="}]},"maintainers":[{"name":"paulocoghi","email":"paulo@coghi.com.br"}],"_npmUser":{"name":"paulocoghi","email":"paulo@coghi.com.br"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/unitflow_0.9.0_1582925688793_0.8410181719270822"},"_hasShrinkwrap":false},"1.0.0":{"name":"@alumna/unitflow","version":"1.0.0","description":"Organize your library or project, defining flows composable by a sequence of units","main":"dist/unitflow.cjs.js","module":"dist/unitflow.es.js","scripts":{"build":"rollup --config rollup/cjs.js && rollup --config rollup/es.js","prepare":"npm run build","test":"jest --coverage"},"repository":{"type":"git","url":"git+https://github.com/alumna/unitflow.git"},"author":{"name":"Paulo Coghi"},"license":"MIT","bugs":{"url":"https://github.com/alumna/unitflow/issues"},"homepage":"https://github.com/alumna/unitflow#readme","jest":{"coverageDirectory":"./coverage/","collectCoverage":true,"collectCoverageFrom":["**/src/**","!**/dist/**","!**/rollup/**","!**/node_modules/**"],"verbose":true,"testEnvironment":"node"},"babel":{"env":{"test":{"plugins":["@babel/plugin-transform-modules-commonjs"]}}},"devDependencies":{"@babel/plugin-transform-modules-commonjs":"^7.8.3","jest":"^25.1.0","rollup":"^1.32.0","rollup-plugin-terser":"^5.2.0"},"gitHead":"abe25d6d854880c9aad558364c1ad784463f9c54","_id":"@alumna/unitflow@1.0.0","_nodeVersion":"12.16.1","_npmVersion":"6.14.1","dist":{"integrity":"sha512-oPuUkKpEXpLLT8/2Q4d76Cdf2O+hncLJa9AmhbJoxb49OeS23Ps7IEZN+qRNHM7ei+wANBi1m01Vx9HtBz/+KQ==","shasum":"8874222c3924ab5a688d54689f8c4e6074d26960","tarball":"https://registry.npmjs.org/@alumna/unitflow/-/unitflow-1.0.0.tgz","fileCount":7,"unpackedSize":12504,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeXT7ECRA9TVsSAnZWagAAYIkP/0rnC1ATfyyh5meQiJhc\n6FPjAyshA8K4sYbkZ9Uae8nmFBXD073kafEGcdQM6qmlOqKJDDh+gCfWEHlM\nWHW5pi67Co5Kf251QoJvSuF+paCLTMP+RNXiKfr+9VW/jDqVKnPEKETj/VeL\nSqWK3okwbzhtVG2WTdi4RbxwcJfZBwrOsjzhY7bHTfSM7RuPsVyDkdxRXRbC\nVIXWriRZEwwpud84wB9uvkQNDHz4JGBHpP1WVh06H1msaomL0qhouF802BMM\nmpvSS0hA/AicslAqJBwvnLBKcBQK6/3EkQaMmOtvy0FfYaTJiZt8jCOdIgAS\nLShh2shwJOED0cPbQ0U/Wf5DlVTEHvxmyulSY8dQ0DVIppqBsjRe6Pag6rEp\nisj7l48DiQ1HGoIM5M4WeWho1qOv1el7kq63h7bxIDSq+358xJcLZnBiEk8D\nPiEn6yIRGa1ExFWHpgKf7CDfQ2UpWDZgwwUq3xCps1kxP4DTTcmTCyGd0V/6\nEAclkA8glzL+qggIu0LpuuYT55jUiKcK4/7F/LZRHpEeiO715A25TYT9QTtA\n/Z9VWiA8L17Mm2NMBZ2weoCtM2vIZdhXfGbqDIlRR3KvjEZlXc5BAJvoesUH\nQHWOMHbZAtgiurRBrbWge+4fqRpmcBpa373rg2ma9lmxb7eIP/+vGnKB1wkv\nAypM\r\n=lL7A\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDqB4OXCBnJWCUF/4YxwWDu+LuiW+tzt5e+tcItFFXuowIhALLcQk50mI+ktF1pazolEAPwPT26tmAXJ6W1DsHHCLu/"}]},"maintainers":[{"name":"paulocoghi","email":"paulo@coghi.com.br"}],"_npmUser":{"name":"paulocoghi","email":"paulo@coghi.com.br"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/unitflow_1.0.0_1583169219969_0.2734778236899058"},"_hasShrinkwrap":false},"1.0.1":{"name":"@alumna/unitflow","version":"1.0.1","description":"Organize your library or project, defining flows composable by a sequence of units","main":"dist/unitflow.cjs.js","module":"dist/unitflow.es.js","scripts":{"build":"rollup --config rollup/cjs.js && rollup --config rollup/es.js","prepare":"npm run build","test":"jest --coverage"},"repository":{"type":"git","url":"git+https://github.com/alumna/unitflow.git"},"author":{"name":"Paulo Coghi"},"license":"MIT","bugs":{"url":"https://github.com/alumna/unitflow/issues"},"homepage":"https://github.com/alumna/unitflow#readme","jest":{"coverageDirectory":"./coverage/","collectCoverage":true,"collectCoverageFrom":["**/src/**","!**/dist/**","!**/rollup/**","!**/node_modules/**"],"verbose":true,"testEnvironment":"node"},"babel":{"env":{"test":{"plugins":["@babel/plugin-transform-modules-commonjs"]}}},"devDependencies":{"@babel/plugin-transform-modules-commonjs":"^7.10.4","jest":"^26.1.0","rollup":"^2.22.1","rollup-plugin-terser":"^6.1.0"},"gitHead":"8e03ccfac25c17d6f08867da233cd8bf82b89b58","_id":"@alumna/unitflow@1.0.1","_nodeVersion":"14.5.0","_npmVersion":"6.14.6","dist":{"integrity":"sha512-f7H0ZhFPvb5j46SFiVSYyvpxpY3c8rGSTuaTJvn25nZq0cgGy2Ddl3JYrG2GQPDtVbjs5e7W2wWghvCH3BGh3w==","shasum":"a210d76e19e3f83711bde8af787d24f6d8ce54c5","tarball":"https://registry.npmjs.org/@alumna/unitflow/-/unitflow-1.0.1.tgz","fileCount":7,"unpackedSize":10742,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh11d6CRA9TVsSAnZWagAArOYQAJzGrzEHlUDicpNhKthd\naR1wjq1vkatjqWUqZw1SVXb9Gv+0eznONlH/LacRzW+8JEcyd0RCMhqsJZ++\nTTDg/h80GgDqj9Du5n+6zW92StU2mSmsgZAAZpQQN41tcBssYM6cahfTxW5n\nBI3IEQttz4Q2SMY1MJ1WlDr2HayU9UznvuZwii/Z6QiUg0u2OEMwAJcGZ+Hy\n6h/sao/zH5AM/E7CprERdpMcCWMLRgQUxT1sG80LysMK1g7ADq+TjnB29v9d\nAOVA9vPXlsNliwpu8MZ573boMWz4LCMHaXSCq43pvbxCNB95MLb4n+WVbP8a\nIJPedVyNqgNJLrPhsWPBcXBPCj+FFOTB03J1RQuG175crOrmMVMihlJ3eU9h\n/d3mQ7KDxhtfMBIAFsWIF8IifNZCPtbpHRTGwOvzU38o4Rc2l+Cufe1lE1yH\n59rUTlwV18hspxgsUcf476DR7SI2hbk8ejOd178eIxeO1ak1AaIypgkNf9R6\nKwVsF0uPwUHMN849/y2Ke6ugrwT+57EmxWmW40TeBChI3V650SDtm/y/YI85\ncoEhTJ0QaaWvYlWiF+Rsi1oGWgM7FJQ61oSjTiSkn+fSl0gRqF7Ou3oZehc+\nTZeJuuZD3Qomjo/qmKZzeay7TzHN0dCMNeOEziF9ev0x8pU/ZsYgInSIlNyD\nL3Wm\r\n=FCVf\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD/kzaMJoQ2VGXFTW43klrH85kFUY3D1B11hYotmBhQbgIgQHYjs236u9V3sZ0296314B4AcFBLyz8CyvVESu2Jm7c="}]},"maintainers":[{"name":"paulocoghi","email":"paulo@coghi.com.br"}],"_npmUser":{"name":"paulocoghi","email":"paulo@coghi.com.br"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/unitflow_1.0.1_1595280367171_0.16874672154792902"},"_hasShrinkwrap":false},"1.0.2":{"name":"@alumna/unitflow","version":"1.0.2","description":"Organize your library or project, defining flows composable by a sequence of units","exports":{"import":"./dist/unitflow.mjs","require":"./dist/unitflow.cjs","default":"./dist/unitflow.mjs"},"main":"dist/unitflow.cjs","module":"dist/unitflow.mjs","type":"module","scripts":{"build":"rollup --config rollup/cjs.js && rollup --config rollup/es.js","prepare":"rollup --config rollup/cjs.js && rollup --config rollup/es.js","test":"node --experimental-vm-modules node_modules/jest/bin/jest.js --coverage"},"repository":{"type":"git","url":"git+https://github.com/alumna/unitflow.git"},"author":{"name":"Paulo Coghi"},"license":"MIT","bugs":{"url":"https://github.com/alumna/unitflow/issues"},"homepage":"https://github.com/alumna/unitflow#readme","jest":{"coverageDirectory":"./coverage/","collectCoverage":true,"collectCoverageFrom":["**/src/**","!**/dist/**","!**/rollup/**","!**/node_modules/**"],"verbose":true,"testEnvironment":"node","transform":{}},"devDependencies":{"jest":"^29.7.0","rollup":"^4.9.5","@rollup/plugin-terser":"^0.4.4"},"_id":"@alumna/unitflow@1.0.2","gitHead":"6ae744cc1835cc8de30ab404dffc8b7ec12188b3","_nodeVersion":"21.5.0","_npmVersion":"10.2.4","dist":{"integrity":"sha512-87bpOOwqFR11BZu1ycIVTHAi4l90oJe3RDRHGJpWf0x91okOlcvJUc5OhdRuRKYy9jgWpnwdY7/J/vD5rYFfpA==","shasum":"5af06e26dc893beaa44f237a0e1709ec41570640","tarball":"https://registry.npmjs.org/@alumna/unitflow/-/unitflow-1.0.2.tgz","fileCount":9,"unpackedSize":14212,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDQbH8/Fyfigve6IIIrmirO5JqS1b3WECwQ1Ki/DsiMCQIhAJawkbKtLq3+zFo/MSo7NS61YfTI3WXXpO7o07RvSU1o"}]},"_npmUser":{"name":"paulocoghi","email":"paulo@adimira.com"},"directories":{},"maintainers":[{"name":"jampix","email":"pasqualemazzei@gmail.com"},{"name":"paulocoghi","email":"paulo@adimira.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/unitflow_1.0.2_1705677627544_0.03555427615109408"},"_hasShrinkwrap":false},"1.0.3":{"name":"@alumna/unitflow","version":"1.0.3","description":"Organize your library or project, defining flows composable by a sequence of units","exports":{"import":"./dist/unitflow.mjs","require":"./dist/unitflow.cjs","default":"./dist/unitflow.mjs"},"main":"dist/unitflow.cjs","module":"dist/unitflow.mjs","type":"module","scripts":{"build":"rollup --config rollup/cjs.js && rollup --config rollup/es.js","prepare":"rollup --config rollup/cjs.js && rollup --config rollup/es.js","test":"node --experimental-vm-modules node_modules/jest/bin/jest.js --coverage"},"repository":{"type":"git","url":"git+https://github.com/alumna/unitflow.git"},"author":{"name":"Paulo Coghi"},"license":"MIT","bugs":{"url":"https://github.com/alumna/unitflow/issues"},"homepage":"https://github.com/alumna/unitflow#readme","jest":{"coverageDirectory":"./coverage/","collectCoverage":true,"collectCoverageFrom":["**/src/**","!**/dist/**","!**/rollup/**","!**/node_modules/**"],"verbose":true,"testEnvironment":"node","transform":{}},"devDependencies":{"jest":"^29.7.0","rollup":"^4.9.5","@rollup/plugin-terser":"^0.4.4"},"_id":"@alumna/unitflow@1.0.3","gitHead":"a1f2c5c75e1de412c0623dd55b6489101e7eee7f","_nodeVersion":"21.5.0","_npmVersion":"10.2.4","dist":{"integrity":"sha512-yweIIGzymD+Ix8zjQPIc/mNx0qtDiLfSmNb++kyWsfRKrRfmfDaJIE/KidiEElXF1AJCErHGVNIMFHJgCqwGrQ==","shasum":"2fb5b4d3ea8e5f37a5836279ae2116e942b7a581","tarball":"https://registry.npmjs.org/@alumna/unitflow/-/unitflow-1.0.3.tgz","fileCount":9,"unpackedSize":14583,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIG+YhB9WTI5VPBAflRgIFbdTjblv2VA4ViAd0ZAjnQr2AiAg2A06jk7y0RhoxbRL9qRftwGG3lPBiYMZr5S80bnRhg=="}]},"_npmUser":{"name":"paulocoghi","email":"paulo@adimira.com"},"directories":{},"maintainers":[{"name":"jampix","email":"pasqualemazzei@gmail.com"},{"name":"paulocoghi","email":"paulo@adimira.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/unitflow_1.0.3_1705693578333_0.2759350702283003"},"_hasShrinkwrap":false}},"time":{"created":"2020-02-28T21:34:48.547Z","0.9.0":"2020-02-28T21:34:48.897Z","modified":"2024-01-19T19:46:18.707Z","1.0.0":"2020-03-02T17:13:40.108Z","1.0.1":"2020-07-20T21:26:07.312Z","1.0.2":"2024-01-19T15:20:27.812Z","1.0.3":"2024-01-19T19:46:18.485Z"},"maintainers":[{"name":"jampix","email":"pasqualemazzei@gmail.com"},{"name":"paulocoghi","email":"paulo@adimira.com"}],"description":"Organize your library or project, defining flows composable by a sequence of units","homepage":"https://github.com/alumna/unitflow#readme","repository":{"type":"git","url":"git+https://github.com/alumna/unitflow.git"},"author":{"name":"Paulo Coghi"},"bugs":{"url":"https://github.com/alumna/unitflow/issues"},"license":"MIT","readme":"<div align=\"center\">\n\t<img src=\"https://github.com/alumna/unitflow/raw/master/unitflow.svg?sanitize=true\" alt=\"unitflow\" width=\"640\" height=\"360\" />\n</div>\n\n<div align=\"center\">\n\t<a href=\"https://npmjs.org/package/@alumna/unitflow\">\n\t\t<img src=\"https://badgen.now.sh/npm/v/@alumna/unitflow\" alt=\"version\" />\n\t</a>\n\t<a href=\"https://npmjs.org/package/@alumna/unitflow\">\n\t\t<img src=\"https://badgen.net/bundlephobia/min/@alumna/unitflow\" alt=\"size\" />\n\t</a>\n\t<a href='https://codecov.io/gh/alumna/unitflow/'>\n\t\t<img src='https://codecov.io/gh/alumna/unitflow/graph/badge.svg' alt='Coverage Status' />\n\t</a>\n\t<a href=\"https://npmjs.org/package/@alumna/unitflow\">\n\t\t<img src=\"https://badgen.now.sh/npm/dm/@alumna/unitflow\" alt=\"downloads\" />\n\t</a>\n</div>\n\n<div align=\"center\">Organize your library or project, defining flows composable by a sequence of units</div>\n\n<br/>\n\n## Introducing Unitflow\n\n**Easily orgnize complex libraries in Javascript**\n\nUnitFlow can be used on any type of project, but it is aimed to be used when building libraries.\n\nIt's common to find yourself racking your brain to translate into code a complex sequence of different activities. Also, it is even more difficult to maintain and grow a code like that.\n\nUnitFlow is a response to this problem. It gives a tangible approach to organize all the workflow of your library or project by making the sequence of activities more visual on your code.\n\n## Key Features\n\n* Extremely lightweight with **no dependencies** – 1.3kB!\n* Fully asynchronous, non-blocking and reactive\n\n## How UnitFlow works\n\n* A **flow** is a sequence of **units**\n* Units are functions with isolated pieces of the logic your library must execute\n* After defining a unit, you can use it in as many flows as you want, one or many\n* You can define multiple flows with no limits of units in each one\n* Each unit is always called with two arguments: `state` and `next`\n* `state` is a writable object available to all units and can *(optionally)* be initialized with upfront data\n* `next` is the function to be called *(without arguments)* inside the unit when its work is done\n* A unit can create new flows or call existing ones, allowing the organization of really complex scenarios\n* Units that create or call flows can retrieve their instance with the keyword `this` to do so\n* Each unit can specify execution dependencies on other units\n* Units with dependencies will be called only after their dependencies have completed\n* You can run **multiple flows** in parallel and define dependencies between **different units on different flows**\n\n## Extra beneficts\n\n* Each flow's run returns a promise that resolves after all its units have completed\n* Units waiting its dependencies remain non-active and **do not consume memory or processing**\n\n\n## Install\n\n```\n$ npm install @alumna/unitflow\n```\n\nAdditionally, this module is delivered as:\n\n* **ES Module**: [`dist/unitflow.mjs`](https://unpkg.com/@alumna/unitflow/dist/unitflow.mjs)\n* **CommonJS**: [`dist/unitflow.cjs`](https://unpkg.com/@alumna/unitflow/dist/unitflow.cjs)\n\n\n## Usage: single flow\n\n```js\nimport { Unitflow } from '@alumna/unitflow';\n\n// create an instance\nconst mylib = new Unitflow({ /* optional data for initial state */ });\n\n// defining units\nmylib.unit[ 'unit_1' ] = function ( state, next ) { /* ... */ }\nmylib.unit[ 'unit_2' ] = function ( state, next ) { /* ... */ }\n\n// defining a flow\nmylib.flow[ 'flow_1' ] = [ 'unit_1', 'unit_2' ]\n\n// running a single flow\nmylib.run( 'flow_1' )\n\n```\n\n## Special third argument `end`\n\nIn any unit you can optionally end a flow using the third argument `end`. When calling it, flow will not continue:\n\n```js\nimport { Unitflow } from '@alumna/unitflow';\n\n// create an instance\nconst mylib = new Unitflow();\n\n// defining units\nmylib.unit[ 'unit_1' ] = function ( state, next, end ) {\n\t\n\t// If true, the flow will stop and unit_2 will not be called\n\tif ( something_bad_happens == true )\n\t\treturn end();\n}\n\nmylib.unit[ 'unit_2' ] = function ( state, next ) { /* ... */ }\n\n// defining a flow\nmylib.flow[ 'flow_1' ] = [ 'unit_1', 'unit_2' ]\n\n// running a single flow\nmylib.run( 'flow_1' )\n\n```\n\n\n\n## Usage: multiple flows\n\n```js\nimport { Unitflow } from '@alumna/unitflow';\n\n// create an instance\nconst mylib = new Unitflow({ /* optional data for initial state */ });\n\n// defining units\nmylib.unit[ 'unit_1' ] = function ( state, next ) { /* ... */ }\nmylib.unit[ 'unit_2' ] = function ( state, next ) { /* ... */ }\nmylib.unit[ 'unit_3' ] = function ( state, next ) { /* ... */ }\nmylib.unit[ 'unit_4' ] = function ( state, next ) { /* ... */ }\n\n// defining the flows\nmylib.flow[ 'flow_1' ] = [ 'unit_1', 'unit_2' ]\nmylib.flow[ 'flow_2' ] = [ 'unit_3', 'unit_4' ]\n\n// running multiple flows in parallel\nmylib.run( 'flow_1', 'flow_2' )\n\n```\n\n## Defining execution dependencies\n\nEven though everything runs asynchronously on Unitflow, optionally you can define dependencies between specific units to ensure that a unit with one or more dependencies will only start after all of them have completed\n\n```js\n// considering the last example, but changing the \"run\" call, where\n// the second argument is defining the execution dependencies\n\nmylib.run( 'flow_1', 'flow_2', {\n\n\t// The \"unit_4\" on \"flow_2\" must be executed only after the \"unit_2\" on \"flow_1\"\n\t'flow_2:unit_4': [ 'flow_1:unit_2' ]\n\n})\n\n```\n","readmeFilename":"README.md"}