Skip to content

Commit

Permalink
Document Q.any and credit @vergara.
Browse files Browse the repository at this point in the history
  • Loading branch information
kriskowal committed Feb 22, 2015
1 parent 408e69c commit 0db9a02
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## 1.2.0

- Added Q.any(promisesArray) method.
- Added Q.any(promisesArray) method (@vergara).
Returns a promise fulfilled with the value of the first resolved promise in
promisesArray. If all promises in promisesArray are rejected, it returns
a rejected promise.
Expand Down
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,18 @@ Q.allSettled(promises)
});
```

The ``any`` function accepts an array of promises and returns a promise that is
fulfilled by the first given promise to be fulfilled, or rejected if all of the
given promises are rejected.

```javascript
Q.any(promises)
.then(function (first) {
// Any of the promises was fulfilled.
}, function (error) {
// All of the promises were rejected.
});
```

### Sequences

Expand Down

0 comments on commit 0db9a02

Please sign in to comment.