-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
45 lines (42 loc) · 1.16 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// Generated by CoffeeScript 1.10.0
(function() {
var NativePromise;
NativePromise = Promise;
module.exports = function(Request, Promise) {
if (Promise == null) {
Promise = NativePromise;
}
Request.Request.prototype.endAsync = function() {
return new Promise((function(_this) {
return function(resolve, reject) {
var error, error1;
try {
return _this.end(function(error, response) {
if (error) {
reject(error);
return;
}
if (response.error) {
reject(response.error);
return;
}
return resolve(response);
});
} catch (error1) {
error = error1;
return reject(error);
}
};
})(this));
};
Request.Request.prototype.then = function() {
var ref;
return (ref = this.endAsync()).then.apply(ref, arguments);
};
Request.Request.prototype["catch"] = function() {
var ref;
return (ref = this.endAsync())["catch"].apply(ref, arguments);
};
return Request;
};
}).call(this);