Skip to content

Commit 1173509

Browse files
committed
Update index.js
It was almost bug: imagine args is array but callback is not defined - in this case all args (that is consists of one array) are packing to new array. That mean we get this: this.send_command(command, [[...]]). It doesn't make any sense. After I fix it we get this: this.send_command(command, [...], undefined). It's really ok because if we call for example client.hget("test", "aaa") we actually do the same: this.send_command("hget", ["test", "aaa"], undefined). No different from this.send_command(command, [...], undefined). By the way, «this.send_command(command, [[...]])» could be a bug. Try to call client.eval(["return 1", 0]) and you should get throw because "eval" required 2 param, but program thinks it's only one param: ["return 1", 0] (at the beginning it was [["return 1", 0]]). There's only one reason why you don't get throw - RedisClient.prototype.eval is overridden for some optimizations, lucky. But that doesn't mean everything is ok.
1 parent a2ebe4f commit 1173509

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -985,7 +985,7 @@ commands.forEach(function (fullCommand) {
985985
var command = fullCommand.split(' ')[0];
986986

987987
RedisClient.prototype[command] = function (args, callback) {
988-
if (Array.isArray(args) && typeof callback === "function") {
988+
if (Array.isArray(args)) {
989989
return this.send_command(command, args, callback);
990990
} else {
991991
return this.send_command(command, to_array(arguments));

0 commit comments

Comments
 (0)