New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

slumber

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

slumber - npm Package Compare versions

Comparing version

to
0.4.1

110

lib/API.js

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 1.6.3
// Generated by CoffeeScript 1.7.1
(function() {

@@ -50,3 +50,3 @@ var API, Serializer, append_slash, callable, debug, querystring, request, _ref,

}
this.serializer = (_base4 = this.opts).serializer != null ? (_base4 = this.opts).serializer : _base4.serializer = new Serializer(this.opts.format);
this.serializer = (_base4 = this.opts).serializer != null ? _base4.serializer : _base4.serializer = new Serializer(this.opts.format);
if (this.opts.append_slash) {

@@ -119,2 +119,5 @@ this.opts.base_url = append_slash(this.opts.base_url);

}
if (this.opts.proxy) {
request_options.proxy = opts.proxy;
}
debug("" + method, request_options.url);

@@ -168,4 +171,3 @@ return req = request(request_options, fn);

_Class.prototype.get = function(query, fn) {
var handle, opts, resp,
_this = this;
var handle, opts, resp;
if ('function' === typeof query) {

@@ -176,10 +178,12 @@ fn = query;

opts = this._prepare_opts(query, 'args');
handle = function(err, response, body) {
var _ref1;
if ((200 <= (_ref1 = response.statusCode) && _ref1 <= 299)) {
return _this.wrap_response(fn, err, response, _this._try_to_serialize(response, body));
} else {
return _this.wrap_response(fn, true, response, null);
}
};
handle = (function(_this) {
return function(err, response, body) {
var _ref1;
if ((200 <= (_ref1 = response.statusCode) && _ref1 <= 299)) {
return _this.wrap_response(fn, err, response, _this._try_to_serialize(response, body));
} else {
return _this.wrap_response(fn, true, response, null);
}
};
})(this);
return resp = this._request('GET', opts, handle);

@@ -189,4 +193,3 @@ };

_Class.prototype["delete"] = function(query, fn) {
var handle, opts, resp,
_this = this;
var handle, opts, resp;
if ('function' === typeof query) {

@@ -197,14 +200,16 @@ fn = query;

opts = this._prepare_opts(query, 'args');
handle = function(err, response, body) {
var _ref1;
if ((200 <= (_ref1 = response.statusCode) && _ref1 <= 299)) {
if (response.statusCode === 204) {
return _this.wrap_response(fn, err, response, true);
handle = (function(_this) {
return function(err, response, body) {
var _ref1;
if ((200 <= (_ref1 = response.statusCode) && _ref1 <= 299)) {
if (response.statusCode === 204) {
return _this.wrap_response(fn, err, response, true);
} else {
return _this.wrap_response(fn, err, response, true);
}
} else {
return _this.wrap_response(fn, err, response, true);
return _this.wrap_reponse(fn, true, response, false);
}
} else {
return _this.wrap_reponse(fn, true, response, false);
}
};
};
})(this);
return resp = this._request('DELETE', opts, handle);

@@ -214,12 +219,13 @@ };

_Class.prototype.post = function(data, fn) {
var handle, opts, resp,
_this = this;
var handle, opts, resp;
opts = this._prepare_opts(data, 'data');
handle = function(err, response, body) {
var _ref1;
if ((200 <= (_ref1 = response.statusCode) && _ref1 <= 299)) {
return _this.wrap_response(fn, err, response, _this._try_to_serialize(response, body));
}
return _this.wrap_response(fn, err, response, true);
};
handle = (function(_this) {
return function(err, response, body) {
var _ref1;
if ((200 <= (_ref1 = response.statusCode) && _ref1 <= 299)) {
return _this.wrap_response(fn, err, response, _this._try_to_serialize(response, body));
}
return _this.wrap_response(fn, err, response, true);
};
})(this);
return resp = this._request('POST', opts, handle);

@@ -229,12 +235,13 @@ };

_Class.prototype.put = function(data, fn) {
var handle, opts, resp,
_this = this;
var handle, opts, resp;
opts = this._prepare_opts(data, 'data');
handle = function(err, response, body) {
var _ref1;
if ((200 <= (_ref1 = response.statusCode) && _ref1 <= 299)) {
return _this.wrap_response(fn, err, response, _this._try_to_serialize(response, body));
}
return _this.wrap_response(fn, true, response, null);
};
handle = (function(_this) {
return function(err, response, body) {
var _ref1;
if ((200 <= (_ref1 = response.statusCode) && _ref1 <= 299)) {
return _this.wrap_response(fn, err, response, _this._try_to_serialize(response, body));
}
return _this.wrap_response(fn, true, response, null);
};
})(this);
return resp = this._request('PUT', opts, handle);

@@ -244,12 +251,13 @@ };

_Class.prototype.patch = function(data, fn) {
var handle, opts, resp,
_this = this;
var handle, opts, resp;
opts = this._prepare_opts(data, 'data');
handle = function(err, response, body) {
var _ref1;
if ((200 <= (_ref1 = response.statusCode) && _ref1 <= 299)) {
return _this.wrap_response(fn, err, response, _this._try_to_serialize(response, body));
}
return _this.wrap_response(fn, err, response, true);
};
handle = (function(_this) {
return function(err, response, body) {
var _ref1;
if ((200 <= (_ref1 = response.statusCode) && _ref1 <= 299)) {
return _this.wrap_response(fn, err, response, _this._try_to_serialize(response, body));
}
return _this.wrap_response(fn, err, response, true);
};
})(this);
return resp = this._request('PATCH', opts, handle);

@@ -256,0 +264,0 @@ };

{
"name": "slumber",
"version": "0.3.4",
"version": "0.4.1",
"description": "Port of Python's slumber library -- A library that makes consuming a RESTful API easier and more convenient",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -64,2 +64,7 @@ Slumber (Node.js version)

Development
-----------
[![Gitter chat](https://badges.gitter.im/moul/node-slumber.png)](https://gitter.im/moul/node-slumber)
Requirements

@@ -66,0 +71,0 @@ ------------

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet