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.3.2

34

lib/API.js

@@ -28,2 +28,3 @@ // Generated by CoffeeScript 1.6.3

this.get = __bind(this.get, this);
this.wrap_response = __bind(this.wrap_response, this);
this._prepare_opts = __bind(this._prepare_opts, this);

@@ -154,2 +155,13 @@ this._request = __bind(this._request, this);

_Class.prototype.wrap_response = function(fn, err, response, ret) {
switch (fn.length) {
case 1:
return fn(ret);
case 2:
return fn(err, ret);
case 3:
return fn(err, response, ret);
}
};
_Class.prototype.get = function(query, fn) {

@@ -166,5 +178,5 @@ var handle, opts, resp,

if ((200 <= (_ref1 = response.statusCode) && _ref1 <= 299)) {
return fn(err, _this._try_to_serialize(response, body));
return _this.wrap_response(fn, err, response, _this._try_to_serialize(response, body));
} else {
return fn(true, response.statusCode);
return _this.wrap_response(fn, true, response, null);
}

@@ -187,8 +199,8 @@ };

if (response.statusCode === 204) {
return fn(err, true);
return _this.wrap_response(fn, err, response, true);
} else {
return fn(err, true);
return _this.wrap_response(fn, err, response, true);
}
} else {
return fn(true, false);
return _this.wrap_reponse(fn, true, response, false);
}

@@ -206,5 +218,5 @@ };

if ((200 <= (_ref1 = response.statusCode) && _ref1 <= 299)) {
return fn(err, _this._try_to_serialize(response, body));
return _this.wrap_response(fn, err, response, _this._try_to_serialize(response, body));
}
return fn(true);
return _this.wrap_response(fn, err, response, true);
};

@@ -221,5 +233,5 @@ return resp = this._request('POST', opts, handle);

if ((200 <= (_ref1 = response.statusCode) && _ref1 <= 299)) {
return fn(err, _this._try_to_serialize(response, body));
return _this.wrap_response(fn, err, response, _this._try_to_serialize(response, body));
}
return fn(true);
return _this.wrap_response(fn, true, response, null);
};

@@ -236,5 +248,5 @@ return resp = this._request('PUT', opts, handle);

if ((200 <= (_ref1 = response.statusCode) && _ref1 <= 299)) {
return fn(err, _this._try_to_serialize(response, body));
return _this.wrap_response(fn, err, response, _this._try_to_serialize(response, body));
}
return fn(true);
return _this.wrap_response(fn, err, response, true);
};

@@ -241,0 +253,0 @@ return resp = this._request('PATCH', opts, handle);

{
"name": "slumber",
"version": "0.3.1",
"version": "0.3.2",
"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",

Sorry, the diff of this file is not supported yet