# when-all

> normalize an object/array where some values may be wrapped in Results

Latest version **0.4.8** (published 2014-03-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install when-all
pnpm add when-all
yarn add when-all
bun add when-all
```

## 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.4.8 |
| Published | 2014-03-02 |
| First published | 2013-04-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Jake Rosoman |
| Maintainers | jkroso |
| Keywords | when, result |

## Links

- npm: https://www.npmjs.com/package/when-all
- Repository: https://github.com/jkroso/when-all
- Issues: https://github.com/jkroso/when-all/issues
- npm.io page: https://npm.io/package/when-all

## Dependencies (3)

- [map](https://npm.io/package/map.md) jkroso/map#0.2.11
- [result](https://npm.io/package/result.md) ~1.0.1
- [result-type](https://npm.io/package/result-type.md) 1.0.0

## Recent versions

- 0.4.8 (latest) — 2014-03-02
- 0.4.7 — 2014-03-02
- 0.4.6 — 2013-11-23
- 0.4.5 — 2013-09-08
- 0.4.4 — 2013-07-17
- 0.4.3 — 2013-06-24
- 0.4.2 — 2013-06-23
- 0.4.1 — 2013-06-22
- 0.4.0 — 2013-06-20
- 0.3.0 — 2013-04-29
- 0.2.2 — 2013-04-26

## README

# when-all

  normalize an object/array where some value may be wrapped in [Results](//github.com/jkroso/result)

## Installation

_With [component](//github.com/component/component), [packin](//github.com/jkroso/packin)_  

    $ {package mananger} install jkroso/when-all

_With [npm](//github.com/isaacs/npm)_  

    $ npm install --save when-all

then in your app:

```js
var all = require('when-all')
```

## API

  - [all()](#all)

### all(x)

  Create a Result for a new `x` with all values lifted out of their Results 
  
```js
all([
  getPage('google.com'),
  getPage('google.co.nz')
]).then(compare)
```

```js
all({
  usa: getPage('google.com'),
  nz: getPage('google.co.nz')
}).then(compare)
```

## Example

You could decorate a function so it can take [Results](//github.com/jkroso/result) as arguments.

```js
var all = require('when-all')

function decorate(fn) {
  return function(){
    var self = this
    return all(arguments).then(function(args){
      return fn.apply(self, args)
    })
  }
}

var asyncCompare = decorate(compare)
asyncCompare(
  getPage('google.com'),
  getPage('google.co.nz')
)
```

## Running the tests

```bash
$ make
```

Then open your browser [to](http://localhost:3000/test).

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