# named-promise

> ES6 Promise syntax sugar allowing hash return values in a chain.

Latest version **0.1.3** (published 2016-05-30) · MIT license · 0 weekly downloads

## Install

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

## 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 | 2016-05-30 |
| First published | 2016-05-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Ryan Zhang |
| Maintainers | ryanzyy |
| Keywords | es6, named, promise |

## Links

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

## Alternatives

- [promise-throttle](https://npm.io/package/promise-throttle.md) — 44.2K weekly downloads
- [@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

## Recent versions

- 0.1.3 (latest) — 2016-05-30
- 0.1.2 — 2016-05-27
- 0.1.1 — 2016-05-26

## README

## Synopsis

ES6 Promise syntax sugar allowing hash return values in a chain.

## Code Example

### Array

```javascript
Promise.resolve('result1')
  .then(function(res) {
    return Promise.all([
      res, // result1
      Promise.resolve('result2')
    ]);
  })
  .then(function(arr) {
    var result1 = arr[0];
    var result2 = arr[1];
    // do something with result1 and result2
  })
```

### Hash

```javascript
Promise.resolve('result1')
  .then(function(res) {
    return NamedPromise.all({
      result1: res,
      result2: Promise.resolve('result2')
    });
  })
  .then(function(context) {
    // do something with context
    console.log(context.result1);
    console.log(context.result2);
    return NamedPromise.assign(context, {
      result3: Promise.resolve('result3')
    });
  })
  .then(function(context) {
    // you still have access to all the previous results
    console.log(context.result1);
    console.log(context.result2);
    console.log(context.result3);
  })
  .catch(function(err) { console.log(err); })
```

## Installation

For npm
```
npm install named-promise
```

## Contributing

```
npm install -g gulp
gulp build
```

## Tests

```
npm install jasmine
npm test
```

## API References

```
gulp doc
```

## Contributors

[Yuanyuan Ryan Zhang](https://github.com/ryanzyy)

## License

This software is licensed under the MIT License.

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