Skip to content

Commit

Permalink
fix calling Service#update with only one parameter
Browse files Browse the repository at this point in the history
when calling Service#update with only one parameter, then that parameter should be options not authconfig, and the method should return a Promise
  • Loading branch information
ShiningRay authored May 14, 2017
1 parent f193e89 commit 4d50ed3
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions lib/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,16 @@ Service.prototype.remove = function(callback) {
*/
Service.prototype.update = function(auth, opts, callback) {
var self = this;
if (!callback && typeof opts === 'function') {
callback = opts;
opts = auth;
auth = opts.authconfig || undefined;
if (!callback) {
var t = typeof opts;
if(t === 'function'){
callback = opts;
opts = auth;
auth = opts.authconfig || undefined;
} else if (t === 'undefined'){
opts = auth;
auth = opts.authconfig || undefined;
}
}

var optsf = {
Expand Down

0 comments on commit 4d50ed3

Please sign in to comment.