# promiseful

> Useful patterns with Promise functions

Latest version **0.1.3** (published 2017-05-26) · MIT license · 0 weekly downloads

## Install

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

## 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.1.3 |
| Published | 2017-05-26 |
| First published | 2017-04-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=6.1.0 |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | N. Palani Kumanan |
| Maintainers | palanik |
| Keywords | promise, promises, promiseful, promise functions, promise patterns, promisify, control flow, promise flow, resolve, reject, fulfil, async, asynchronous, async patterns, parallel, parallelLimit, series, race, relay |

## Links

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

## 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.1.3 (latest) — 2017-05-26
- 0.1.2 — 2017-05-22
- 0.1.1 — 2017-04-24
- 0.1.0 — 2017-04-17
- 0.0.1 — 2017-04-12

## README

# promiseful
Useful patterns with Promise functions

[![NPM version](https://img.shields.io/npm/v/promiseful.svg?style=flat)](https://www.npmjs.org/package/promiseful)
[![Build Status](https://img.shields.io/travis/palanik/promiseful.svg?style=flat)](https://travis-ci.org/palanik/promiseful)
[![Known Vulnerabilities](https://snyk.io/test/github/palanik/promiseful/badge.svg)](https://snyk.io/test/github/palanik/promiseful)

## Installation

```sh
$ npm install promiseful --save
```

To use in the browser, download the library from [dist](dist) folder.

## Usage

### node.js
promiseful uses native ES2015 [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise).

To use non-native, 3rd-party `Promise` libraries, like [bluebird](http://bluebirdjs.com/) or [Promise polyfill](https://github.com/jakearchibald/es6-promise/), call `promiseful.promise()` with the `Promise` object, before using the API.

e.g.:
```JS
var Promise = require('bluebird');
// var Promise = require('es6-promise');
// var Promise = require('pinkie-promise');

var promiseful = require('promiseful');

promiseful.promise(Promise);
```

See [example](examples/node.js/es5/server-time.js)

### Browser
promiseful uses native ES2015 [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise).

To use non-native, 3rd-party `Promise` libraries, like [bluebird](http://bluebirdjs.com/) or [Promise polyfill](https://github.com/jakearchibald/es6-promise/), include the library, before including promiseful.

e.g.:
```HTML
<script src="https://cdn.jsdelivr.net/bluebird/latest/bluebird.min.js"></script>
<!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/es6-promise/4.1.0/es6-promise.min.js"></script> -->
<script src="promiseful.js"></script>
```

See [example](examples/browsers/bluebird.html)


## API

A **promiseful function** is a function that returns a [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise).

e.g.:
```JS
function readPasswd() {
  return new Promise((resolve, reject) => {
    fs.readFile('/etc/passwd', (err, data) => {
      if (err) {
        reject(err);
      } else {
        resolve(data);
      }
    });
  });
}
```

The API works with **promiseful functions**. Do not pass **Promise** objects.

Methods follow pattern, similar to the excellent [caolan/async](https://github.com/caolan/async) library.

### API Documentation

  [API](API.md)

## Examples

### Node.js
1. [server-time](examples/node.js/server-time.js)
2. [es5](examples/node.js/es5/server-time.js)

### Browser
1. [fetch-image-dimension](examples/browser/fetch-image-dimension.html)
2. [bluebird](examples/browser/bluebird.html)

## License

  [MIT](LICENSE)

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