# kuji

> Asynchronous Control Flow library for Node

Latest version **0.0.4** (published 2014-07-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install kuji
pnpm add kuji
yarn add kuji
bun add kuji
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.4 |
| Published | 2014-07-30 |
| First published | 2014-07-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 6 |
| Author | Christophe Feijoo |
| Maintainers | kubekhrm |
| Keywords | asynchronous, control-flow, async, promise |

## Links

- npm: https://www.npmjs.com/package/kuji
- Repository: https://github.com/kubekhrm/kuji
- Issues: https://github.com/kubekhrm/kuji/issues
- npm.io page: https://npm.io/package/kuji

## Alternatives

- [@commercetools/sync-actions](https://npm.io/package/@commercetools/sync-actions.md) — 25.1K weekly downloads
- [cwait](https://npm.io/package/cwait.md) — 21.4K weekly downloads
- [@ledgerhq/hw-app-cosmos](https://npm.io/package/@ledgerhq/hw-app-cosmos.md) — 4.2K weekly downloads
- [@financial-times/o-loading](https://npm.io/package/@financial-times/o-loading.md) — 2.8K weekly downloads
- [fa](https://npm.io/package/fa.md) — 185 weekly downloads

## Recent versions

- 0.0.4 (latest) — 2014-07-30
- 0.0.3 — 2014-07-29
- 0.0.2 — 2014-07-27
- 0.0.1 — 2014-07-27

## README

kuji
====

###Asynchronous Control Flow library for Node.

Browsers are not supported yet, it will be added later.

##Control Flow

###kuji.inline
`kuji.inline` runs tasks **in-line**:

![Inline Timeline Example](img/inline.png?raw=true "Inline Timeline Example")

``` javascript
var kuji = require('kuji');

kuji.inline([
  function (next) {
    next();
  },
  function (next) {
    next();
  },
  function (next) {
    next();
  },
  function (next) {
    next();
  }
]);

```

###kuji.parallel
`kuji.parallel` runs tasks **in parallel** and goes to the final callback when all tasks finished:

![Parallel Timeline Example](img/parallel.png?raw=true "Parallel Timeline Example")

``` javascript
var kuji = require('kuji');

kuji.parallel([
  function (next) {
    next();
  },
  function (next) {
    next();
  },
  function (next) {
    next();
  },
  function (next) {
    next();
  }
], function () {
  // This will be executed when all will be finished
});
```

###kuji.graph

`kuji.graph` permits you to easily run __tasks graphs__:

![Graph Timeline Example](img/graph.png?raw=true "Graph Timeline Example")

You can see that __D__ will be executed once its dependencies (__A__ and __B__) are finished, permitting you to be sure that the data you need from these tasks will be available.

For the moment you need to use a closure to share data between tasks, but this will be patched in the next few days.

``` javascript
var kuji = require('kuji'),
    dependsOn = kuji._dependsOn;

kuji.graph({
  a: function (next) {
    next()
  },
  b: function (next) {
    next();
  },
  c: function (next) {  
    next();
  },
  d: dependsOn(['a', 'b'], function (next) {
    next();
  }),
  e: dependsOn(['d', 'c'], function (next) {
    next();
  })
}, function () {
  // This will be executed at the end of your graph
});

```

##Coming next
- Error handling through next()
- Passing values through next()
- Benchmark
- Perfomance optimization

##Testing
To run the tests :
```
mocha
```

##License
MIT

---
_Source: https://npm.io/package/kuji · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
