Comparing version 1.0.88 to 1.0.89
{ | ||
"name": "yow", | ||
"version": "1.0.88", | ||
"version": "1.0.89", | ||
"description": "You Only Wish module", | ||
@@ -5,0 +5,0 @@ "main": "yow.js", |
@@ -6,6 +6,2 @@ | ||
var sprintf = require('yow/sprintf'); | ||
var extend = require('yow/extend'); | ||
var isArray = require('yow/is').isArray; | ||
var isString = require('yow/is').isString; | ||
@@ -15,12 +11,16 @@ var isObject = require('yow/is').isObject; | ||
var debug = function() {}; | ||
function debug() { | ||
}; | ||
class Gopher { | ||
constructor() { | ||
function Gopher() { | ||
var self = this; | ||
function constructor() { | ||
var options = {protocol:'https:'}; | ||
if (isObject(arguments[0])) { | ||
extend(options, arguments[0]); | ||
Object.assign(options, arguments[0]); | ||
} | ||
@@ -42,3 +42,3 @@ | ||
if (isObject(arguments[1])) | ||
extend(options, arguments[1]); | ||
Object.assign(options, arguments[1]); | ||
@@ -51,24 +51,24 @@ } | ||
this.defaultOptions = extend({}, options); | ||
self.defaultOptions = Object.assign({}, options); | ||
} | ||
}; | ||
get() { | ||
return this.request.apply(this, ['GET', ...arguments]); | ||
this.get = function() { | ||
return self.request.apply(self, ['GET'].concat(Array.prototype.slice.call(arguments))); | ||
} | ||
put() { | ||
return this.request.apply(this, ['PUT', ...arguments]); | ||
this.delete = function() { | ||
return self.request.apply(self, ['DELETE'].concat(Array.prototype.slice.call(arguments))); | ||
} | ||
post() { | ||
return this.request.apply(this, ['POST', ...arguments]); | ||
this.post = function() { | ||
return self.request.apply(self, ['POST'].concat(Array.prototype.slice.call(arguments))); | ||
} | ||
delete() { | ||
return this.request.apply(this, ['DELETE', ...arguments]); | ||
this.put = function() { | ||
return self.request.apply(self, ['PUT'].concat(Array.prototype.slice.call(arguments))); | ||
} | ||
this.request = function() { | ||
request() { | ||
debug('Request:', arguments); | ||
@@ -85,7 +85,7 @@ var self = this; | ||
extend(options, arguments[2]); | ||
Object.assign(options, arguments[2]); | ||
} | ||
else { | ||
options.method = arguments[0]; | ||
extend(options, arguments[1]); | ||
Object.assign(options, arguments[1]); | ||
} | ||
@@ -121,3 +121,3 @@ } | ||
var params = {}; | ||
extend(params, self.defaultOptions, options, {headers:headers}); | ||
Object.assign(params, self.defaultOptions, options, {headers:headers}); | ||
@@ -216,4 +216,8 @@ if (isString(params.path) && isObject(params.params)) { | ||
}; | ||
}; | ||
constructor.apply(self, arguments); | ||
} | ||
module.exports = Gopher; |
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
21458
514