# serialp

> Promises in sequence

Latest version **0.2.0** (published 2021-03-09) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.0 |
| Published | 2021-03-09 |
| First published | 2021-03-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 47.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Thierry PAGES |
| Maintainers | thipages |
| Keywords | javascript, sequence, promises |

## Links

- npm: https://www.npmjs.com/package/serialp
- Repository: https://github.com/thipages/serialp
- Homepage: https://github.com/thipages/serialp#readme
- Issues: https://github.com/thipages/serialp/issues
- npm.io page: https://npm.io/package/serialp

## 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.2.0 (latest) — 2021-03-09
- 0.1.2 — 2021-03-08
- 0.1.1 — 2021-03-08

## README

# serialp
Run promises in sequence

## Installation
_npm i serialp_

## Basic example
```javascript
const timeout=duration=>()=>new Promise(
    resolve=>setTimeout(
        ()=>{
            resolve(duration)
        },duration
    )
);
const promises = [
    () => timeout(100),
    () => timeout(200)
];
serialp(promises).then(
    results=>console.log(results) // [[true,100],[true,200]]
);
```

## Usage
```javascript

serialp(arrayOfPromisesFunctions,observer)
  .then((x=>{}))
  .catch (x=>{}) // trigered only if observer is an async function
```
1.  x is an array of [success:boolean,result]

2. _observer_ is
- either a _function (index,success,result,results)_ which returns a boolean
   - if observer function returns false, promises execution stops,
   - _observer_ function can be an async function
- or a _boolean_
   - if true (default), all promises will be executed,
   - if false, promises execution will stop at first failure

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