diff --git a/lib/user-methods.js b/lib/user-methods.js index 03363026..7994d71d 100644 --- a/lib/user-methods.js +++ b/lib/user-methods.js @@ -28,7 +28,7 @@ function node_require(module) { function checkTypes(args, types) { args = Array.prototype.slice.call(args); for (var i = 0; i < types.length; ++i) { - if (typeof args[i] !== types[i]) { + if (args.length > i && typeof args[i] !== types[i]) { throw new TypeError('param ' + i + ' must be of type ' + types[i]); } } @@ -154,7 +154,7 @@ const staticMethods = { }, adminUser(token, server) { - checkTypes(arguments, ['string']); + checkTypes(arguments, ['string', 'string']); const uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) { var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8); return v.toString(16);