mirror of
https://github.com/actions/setup-node.git
synced 2025-07-27 00:48:24 +02:00
Use husky
This commit is contained in:
parent
d7b6952411
commit
c3f0a8be66
6685 changed files with 919804 additions and 0 deletions
52
node_modules/rsvp/lib/rsvp/promise/reject.js
generated
vendored
Normal file
52
node_modules/rsvp/lib/rsvp/promise/reject.js
generated
vendored
Normal file
|
@ -0,0 +1,52 @@
|
|||
import {
|
||||
noop,
|
||||
reject as _reject
|
||||
} from '../-internal';
|
||||
|
||||
/**
|
||||
`Promise.reject` returns a promise rejected with the passed `reason`.
|
||||
It is shorthand for the following:
|
||||
|
||||
```javascript
|
||||
import Promise from 'rsvp';
|
||||
|
||||
let promise = new Promise(function(resolve, reject){
|
||||
reject(new Error('WHOOPS'));
|
||||
});
|
||||
|
||||
promise.then(function(value){
|
||||
// Code here doesn't run because the promise is rejected!
|
||||
}, function(reason){
|
||||
// reason.message === 'WHOOPS'
|
||||
});
|
||||
```
|
||||
|
||||
Instead of writing the above, your code now simply becomes the following:
|
||||
|
||||
```javascript
|
||||
import Promise from 'rsvp';
|
||||
|
||||
let promise = Promise.reject(new Error('WHOOPS'));
|
||||
|
||||
promise.then(function(value){
|
||||
// Code here doesn't run because the promise is rejected!
|
||||
}, function(reason){
|
||||
// reason.message === 'WHOOPS'
|
||||
});
|
||||
```
|
||||
|
||||
@method reject
|
||||
@for Promise
|
||||
@static
|
||||
@param {*} reason value that the returned promise will be rejected with.
|
||||
@param {String} label optional string for identifying the returned promise.
|
||||
Useful for tooling.
|
||||
@return {Promise} a promise rejected with the given `reason`.
|
||||
*/
|
||||
export default function reject(reason, label) {
|
||||
/*jshint validthis:true */
|
||||
let Constructor = this;
|
||||
let promise = new Constructor(noop, label);
|
||||
_reject(promise, reason);
|
||||
return promise;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue