# the-promise

> An extension over bluebird promise library.

Latest version **3.0.1** (published 2026-07-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install the-promise
pnpm add the-promise
yarn add the-promise
bun add the-promise
```

## Health

**Score 65/100 (B)** — status: active.

Positive: has types; no vulnerabilities; has provenance; recently updated; high quality score.

Warnings: low downloads; no esm support.

## Facts

| | |
|---|---|
| Version | 3.0.1 |
| Published | 2026-07-07 |
| First published | 2018-01-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 39.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 0 |
| Author | Ruben Hakopian |
| Maintainers | rubenhak |

## Links

- npm: https://www.npmjs.com/package/the-promise
- Repository: https://github.com/rubenhak/nodejs-xpromise
- Homepage: https://github.com/rubenhak/nodejs-xpromise#readme
- Issues: https://github.com/rubenhak/nodejs-xpromise/issues
- npm.io page: https://npm.io/package/the-promise

## Dependencies (1)

- [the-lodash](https://npm.io/package/the-lodash.md) ^3.0.3

## Recent versions

- 3.0.1 (latest) — 2026-07-07
- 2.1.3 — 2023-04-04
- 2.1.2 — 2023-04-04
- 2.1.1 — 2023-04-04
- 2.0.15 — 2022-09-02
- 2.0.13 — 2021-05-18
- 2.0.12 — 2021-03-10
- 2.0.11 — 2021-03-10
- 2.0.10 — 2021-03-09
- 2.0.9 — 2021-03-08
- 2.0.8 — 2021-03-04
- 2.0.7 — 2021-03-04
- 2.0.6 — 2021-03-03
- 2.0.4 — 2021-01-19
- 2.0.3 — 2020-09-25
- … 47 more at https://npm.io/package/the-promise/versions

## README

# Node.js Promise Extension Library
Enhances standard Promise library with useful capabilites.

## Promise.serial
Used for running multiple promises in sequence. If one operation fails the processing fails, root promise stops execution and fails.

**Signature:**

Promise.serial(items, callback) : returns Promise.

**callback** can return Promise. In those cases root Promise will wait this Promise to succeed before proceeding to next iten.

**Usage:**
```js
var items = ['cat', 'dog', 'elephant'];
Promise.serial(items, x => {
    return doSomething(x);
})
.then(() => console.log("All Items Processed!"))

function doSomething(name)
{
    return db.insert(name);
}
```

## Promise.parallel
Used for running multiple promises in parallel. If one operation fails the processing should continue. Nevertheles the top promise should fail.

**Signature:**

Promise.parallel(items, callback) : returns Promise.

**callback** can return Promise. The top Promise should wait for all inner Promises to finish processing.

**Usage:**
```js
var items = ['cat', 'dog', 'elephant'];
Promise.serial(items, x => {
    return doSomething(x);
})
.then(() => console.log("All Items Processed!"))

function doSomething(name)
{
    return db.insert(name);
}
```

## Promise.timeout
Promise which waits and resolves in specified amount of time.

**Signature:**

Promise.timeout(ms) : returns Promise.

**Usage:**
```js
var items = ['cat', 'dog', 'elephant'];
Promise.serial(items, x => {
    return doSomething(x);
})
.

function doSomething(name)
{
    return db.insert(name);
}
```

## Promise.retry
Enables retry capability.

**Signature:**

Promise.retry(action, number, timeout, canContinueCb) : returns Promise.

**action**: action to perform. Can return Promise.

**number**: maximum number of times to retry.

**timeout**: timeout in ms to retry.

**canContinueCb**: An optional callback which tells whether a particual retry can be executed


**Usage 1:**
```js
return Promise.retry(() => doSomething(), 3, 1000);

function doSomething()
{
    return db.insert('Example');
}
```

**Usage 2:**
```js
Promise.retry(() => doSomething(), 3, 1000, () => {
    if (new Date().getHours() > 10) {
        return false;
    }
    return true;
});

function doSomething()
{
    return db.insert('Example');
}
```

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