Comparing version 0.5.0 to 1.0.0
(function() { | ||
var signature; | ||
signature = require("./signature-checker"); | ||
signature = require('./signature-checker'); | ||
@@ -12,13 +12,13 @@ module.exports = { | ||
switch (method) { | ||
case "GET": | ||
case "DELETE": | ||
case "HEAD": | ||
case 'GET': | ||
case 'DELETE': | ||
case 'HEAD': | ||
opts = this.getOpts(args, false); | ||
break; | ||
case "POST": | ||
case "PUT": | ||
case 'POST': | ||
case 'PUT': | ||
opts = this.getOpts(args, true); | ||
break; | ||
default: | ||
throw new Error("Method must be GET, DELETE, POST, PUT or HEAD"); | ||
throw new Error('Method must be GET, DELETE, POST, PUT or HEAD'); | ||
} | ||
@@ -34,3 +34,3 @@ opts.config.method = method; | ||
opts = {}; | ||
if (signature.matches(args, "object", "function")) { | ||
if (signature.matches(args, 'object', 'function')) { | ||
opts.config = args[0]; | ||
@@ -41,3 +41,3 @@ opts.callback = args[1]; | ||
} | ||
} else if (signature.matches(args, "string", "function")) { | ||
} else if (signature.matches(args, 'string', 'function')) { | ||
opts.config = { | ||
@@ -52,3 +52,3 @@ url: args[0] | ||
} | ||
} else if (signature.matches(args, "string", "object", "function") && hasData) { | ||
} else if (signature.matches(args, 'string', 'object', 'function') && hasData) { | ||
opts.config = { | ||
@@ -59,3 +59,3 @@ url: args[0], | ||
opts.callback = args[2]; | ||
} else if (signature.matches(args, "string")) { | ||
} else if (signature.matches(args, 'string')) { | ||
opts.config = { | ||
@@ -69,3 +69,3 @@ url: args[0] | ||
} | ||
} else if (signature.matches(args, "object")) { | ||
} else if (signature.matches(args, 'object')) { | ||
opts.config = args[0]; | ||
@@ -75,3 +75,3 @@ if (opts.config.json === void 0) { | ||
} | ||
} else if (signature.matches(args, "string", "object") && hasData) { | ||
} else if (signature.matches(args, 'string', 'object') && hasData) { | ||
opts.config = { | ||
@@ -82,3 +82,3 @@ url: args[0], | ||
} else { | ||
throw new Error("Invalid params: " + (args.join(', '))); | ||
throw new Error('Invalid params: #{args.join(', ')}'); | ||
} | ||
@@ -85,0 +85,0 @@ return opts; |
(function() { | ||
var ArgParser, RequestAdapter, request, | ||
var argParser, request, requestAdapter, | ||
__slice = [].slice; | ||
RequestAdapter = require("./request-adapter"); | ||
requestAdapter = require('./request-adapter'); | ||
ArgParser = require("./arg-parser"); | ||
argParser = require('./arg-parser'); | ||
@@ -12,4 +12,4 @@ request = function() { | ||
method = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : []; | ||
opts = ArgParser.parse(method, args); | ||
return RequestAdapter.makeRequest(opts.config, opts.callback); | ||
opts = argParser.parse(method, args); | ||
return requestAdapter.makeRequest(opts.config, opts.callback); | ||
}; | ||
@@ -16,0 +16,0 @@ |
(function() { | ||
var Promise, request; | ||
request = require("request"); | ||
request = require('request'); | ||
Promise = require("bluebird"); | ||
Promise = require('bluebird'); | ||
@@ -11,13 +11,10 @@ Promise.prototype.fail = Promise.prototype.caught; | ||
module.exports = { | ||
makeRequest: function(config, callback) { | ||
makeRequest: function(config) { | ||
return new Promise(function(resolve, reject) { | ||
return request(config, function(err, res) { | ||
if (err != null) { | ||
reject(err); | ||
return reject(err); | ||
} else { | ||
resolve(res); | ||
return resolve(res); | ||
} | ||
if (callback) { | ||
return callback(err, res); | ||
} | ||
}); | ||
@@ -24,0 +21,0 @@ }); |
{ | ||
"name": "bluereq", | ||
"version": "0.5.0", | ||
"version": "1.0.0", | ||
"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
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
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
25
0
62109
186