<commit_before># promise-dag

Declarative, modular, minimal-latency asynchronous computations usings graphs of Promises.

**Features:**

* Express complex async workflows using a high-level data structure (instead of wiring promises by hand using `Promise.all()` etc.)
* **No dependencies**. In particular, no dependency to a concrete implementation of Promises;
 you can plug in any Promise implementation (es6-promise, Q, bluebird, when.js, Angular's $q...)
* Lightweight (<1k minified and gzipped)
* *Lazyness:* the only steps which are computed are those you require (and those on which they depend).
* *Automatic minimum latency:* chaining promises by hand often yields suboptimal performance,
 because some steps are run serially which could be run in parallel. `promise-dag` always chains promises.

## Installation

### Node / ES6

```javascript
var promiseDag = require('promise-dag');
```

### Browser

A browser version is available in `js/browser/promise-dag(.min).js`. 
It exports a global `promiseDag` in `window`.

## Using with non-standard Promise implementations

`promiseDag.run()` will look for a standard Promise implementation by assuming a global `Promise` object.

In environments where this implementation is not available / desirable, you can plug in any other Promise implementation using `promiseDag.implement()`;
all you have to do is provide the `Promise.resolved()`, `Promise.reject()` and `Promise.all()` functions.

Here are some examples:
<commit_msg>fixed typos in README<commit_after># promise-dag

Declarative, modular, minimal-latency asynchronous computations usings graphs of Promises.

**Features:**

* Express complex async workflows using a high-level data structure (instead of wiring promises by hand using `Promise.all()` etc.)
* **No dependencies**. In particular, no dependency to a concrete implementation of Promises;
 you can plug in any Promise implementation (es6-promise, Q, bluebird, when.js, Angular's $q...)
* Lightweight (<1k minified and gzipped)
* *Lazyness:* the only steps which are computed are those you require (and those on which they depend).
* *Automatic minimum latency:* chaining promises by hand often yields suboptimal performance,
 because some steps are run serially which could be run in parallel. `promise-dag` always chains promises so as to minimize latency.

## Installation

### Node / ES6

```javascript
var promiseDag = require('promise-dag');
```

### Browser

A browser version is available in `js/browser/promise-dag(.min).js`. 
It exports a global `promiseDag` in `window`.

## Using with non-standard Promise implementations

`promiseDag.run()` will look for a standard Promise implementation by assuming a global `Promise` object.

In environments where this implementation is not available / desirable, you can plug in any other Promise implementation using `promiseDag.implement()`;
all you have to do is provide the `Promise.resolved()`, `Promise.reject()` and `Promise.all()` functions.
`promiseDag.implement()` returns a function which has the same behaviour as `promiseDag.run`.

Here are some examples:

{'fraction_non_alphanumeric': 0.09328599096191091, 'fraction_numerical': 0.001936733376371853, 'mean_word_length': 5.088408644400785, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1902054', 'n_tokens_mistral': 837, 'n_tokens_neox': 789, 'n_words': 381}