rkatic/p — pull request #4 by kitcambridge (2013-08-01 22:44:57+00:00)
Title: Add `P.reject()`

When interfacing with callback-based code, I've found it helpful to return rejected promises—for instance, when a required input is missing—instead of throwing exceptions. My current solution is to construct a resolver and immediately reject the promise, which feels rather cumbersome:

```js
var errorDeferred = P.defer();
errorDeferred.reject(new Error('Missing required parameters.'));
return errorDeferred.promise;
```

This pull request introduces `P.reject`, which returns an immediately-rejected promise. With `.reject()`, the above boilerplate can be condensed to:

```js
return P.reject(new Error('Missing required parameters.'));
```