Comparing version 1.2.2 to 1.2.3
@@ -67,3 +67,3 @@ var _ = require('underscore'); | ||
else | ||
return err; | ||
throw err; | ||
@@ -70,0 +70,0 @@ }; |
var Deferred = require('promise-deferred') | ||
, _ = require('underscore') | ||
; | ||
, _ = require('underscore') | ||
; | ||
@@ -14,5 +14,5 @@ /** | ||
this._type = type; | ||
this._param = param; | ||
this.dfd = Deferred(); | ||
this._type = type; | ||
this._param = param; | ||
this.dfd = Deferred(); | ||
@@ -29,8 +29,14 @@ } | ||
api( | ||
this._type | ||
, this._param | ||
, _.compose(this.dfd.resolve, _.property('response')) | ||
); | ||
return this; | ||
api( | ||
this._type | ||
, this._param | ||
, res => { | ||
if (res.response) { | ||
this.dfd.resolve(res.response); | ||
} else { | ||
this.dfd.reject(res); | ||
} | ||
} | ||
); | ||
return this; | ||
@@ -44,3 +50,3 @@ }; | ||
Request.prototype.toApiString = function () { | ||
return ['API.', this._type, '(', JSON.stringify(this._param), ')'].join(''); | ||
return ['API.', this._type, '(', JSON.stringify(this._param), ')'].join(''); | ||
}; | ||
@@ -47,0 +53,0 @@ |
{ | ||
"name": "1vk", | ||
"version": "1.2.2", | ||
"version": "1.2.3", | ||
"description": "smart and efficient sdk for vk.com API", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
79648
398