# promise.compose2

> compose an array of promises ,return a function that chain resolve promise with an initialization parameter

Latest version **1.0.0** (published 2018-07-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install promise.compose2
pnpm add promise.compose2
yarn add promise.compose2
bun add promise.compose2
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2018-07-05 |
| First published | 2018-07-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 3.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Xu Xi Hai |
| Maintainers | x373241884y |
| Keywords | promise, array, series, compose, javascript, nodejs, fun-fun-functional, pineapple |

## Links

- npm: https://www.npmjs.com/package/promise.compose2
- Repository: https://github.com/xuxihai123/promise.compose2
- Homepage: https://github.com/xuxihai123/promise.compose2#readme
- Issues: https://github.com/xuxihai123/promise.compose2/issues
- npm.io page: https://npm.io/package/promise.compose2

## 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

- 1.0.0 (latest) — 2018-07-05

## README

# promise.compose2
---
[![NPM version](http://img.shields.io/npm/v/promise.compose2.svg?style=flat)](https://npmjs.org/package/promise.compose2)
[![Build Status](http://img.shields.io/travis/xuxihai123/promise.compose2/master.svg?style=flat)](http://travis-ci.org/xuxihai123/promise.compose2)

> compose an array of promises ,return a function that chain resolve promise with an initialization parameter

## Install

```sh
$ npm install promise.compose2
```

## Usage

```js
var compose = require('promise.compose2')

function makeAdder (a) {
  return function (b) {
    b = b || 0
    return Promise.resolve(a + b)
  }
}

var addOne = makeAdder(1)

let composeFn=compose([
                addOne,  // 1
                addOne, // 2
                addOne  // 3
              ]);
composeFn(10)
.then(console.log)
.catch(console.error)
```

## API

#### `compose(functions)` -> `function(ctx)` ->`promise

like koa-compose Runs the array of functions in series, waiting for each to resolve and passing each result to the next function in the array.

##### functions

*Required*
Type: `array[function]`

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