Comparing version
(function() { | ||
var ArgParser, signature; | ||
var signature; | ||
signature = require("./signature-checker"); | ||
ArgParser = (function() { | ||
function ArgParser() {} | ||
ArgParser.prototype.parse = function(method, args) { | ||
module.exports = { | ||
parse: function(method, args) { | ||
var opts; | ||
@@ -28,5 +26,4 @@ opts = {}; | ||
return opts; | ||
}; | ||
ArgParser.prototype.getOpts = function(args, hasData) { | ||
}, | ||
getOpts: function(args, hasData) { | ||
var opts; | ||
@@ -82,10 +79,5 @@ if (hasData == null) { | ||
return opts; | ||
}; | ||
} | ||
}; | ||
return ArgParser; | ||
})(); | ||
module.exports = new ArgParser(); | ||
}).call(this); |
(function() { | ||
var ArgParser, Bluereq, RequestAdapter, | ||
var ArgParser, RequestAdapter, request, | ||
__slice = [].slice; | ||
@@ -9,49 +9,16 @@ | ||
Bluereq = (function() { | ||
var request; | ||
request = function() { | ||
var args, method, opts; | ||
method = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : []; | ||
opts = ArgParser.parse(method, args); | ||
return RequestAdapter.makeRequest(opts.config, opts.callback); | ||
}; | ||
function Bluereq() {} | ||
module.exports = { | ||
get: request.bind(null, "get"), | ||
post: request.bind(null, "post"), | ||
"delete": request.bind(null, "delete"), | ||
put: request.bind(null, "put") | ||
}; | ||
request = function(method, args) { | ||
var opts; | ||
opts = ArgParser.parse(method, args); | ||
return RequestAdapter.makeRequest(opts.config, opts.callback); | ||
}; | ||
Bluereq.get = function() { | ||
var args; | ||
args = 1 <= arguments.length ? __slice.call(arguments, 0) : []; | ||
return request("get", args); | ||
}; | ||
Bluereq.post = function() { | ||
var args; | ||
args = 1 <= arguments.length ? __slice.call(arguments, 0) : []; | ||
return request("post", args); | ||
}; | ||
Bluereq["delete"] = function() { | ||
var args; | ||
args = 1 <= arguments.length ? __slice.call(arguments, 0) : []; | ||
return request("delete", args); | ||
}; | ||
Bluereq.put = function() { | ||
var args; | ||
args = 1 <= arguments.length ? __slice.call(arguments, 0) : []; | ||
return request("put", args); | ||
}; | ||
Bluereq.head = function() { | ||
var args; | ||
args = 1 <= arguments.length ? __slice.call(arguments, 0) : []; | ||
return request("head", args); | ||
}; | ||
return Bluereq; | ||
})(); | ||
module.exports = Bluereq; | ||
}).call(this); |
(function() { | ||
var Promise, RequestAdapter, request; | ||
var Promise, request; | ||
@@ -10,6 +10,4 @@ request = require("request"); | ||
RequestAdapter = (function() { | ||
function RequestAdapter() {} | ||
RequestAdapter.prototype.makeRequest = function(config, callback) { | ||
module.exports = { | ||
makeRequest: function(config, callback) { | ||
return new Promise(function(resolve, reject) { | ||
@@ -27,10 +25,5 @@ return request(config, function(err, res) { | ||
}); | ||
}; | ||
} | ||
}; | ||
return RequestAdapter; | ||
})(); | ||
module.exports = new RequestAdapter(); | ||
}).call(this); |
(function() { | ||
var SignatureChecker, | ||
__slice = [].slice; | ||
var __slice = [].slice; | ||
SignatureChecker = (function() { | ||
function SignatureChecker() {} | ||
SignatureChecker.prototype.matches = function() { | ||
module.exports = { | ||
matches: function() { | ||
var args, i, sig, signature, _i, _len; | ||
@@ -21,10 +18,5 @@ args = arguments[0], signature = 2 <= arguments.length ? __slice.call(arguments, 1) : []; | ||
return true; | ||
}; | ||
} | ||
}; | ||
return SignatureChecker; | ||
})(); | ||
module.exports = new SignatureChecker(); | ||
}).call(this); |
{ | ||
"name": "bluereq", | ||
"version": "0.4.1", | ||
"version": "0.4.2", | ||
"description": "A bluebird promise wrapper for HTTP requests", | ||
@@ -5,0 +5,0 @@ "main": "dist/bluereq.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
68428
-2.04%188
-15.32%