Skip to content

Commit

Permalink
Updated to use the wrapper style
Browse files Browse the repository at this point in the history
  • Loading branch information
toddbluhm committed Dec 20, 2014
1 parent f5b1165 commit 4654012
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions modules/Client.js
Expand Up @@ -181,8 +181,15 @@ Object.defineProperties(Client.prototype, {
});
});
}
}
},

// Optionally accept an array as the only argument to DEL.
del: {
value: function (keys) {
var args = Array.isArray(keys) ? keys : slice.call(arguments, 0);
return this.send('del', args);
}
}
});

// Optionally accept an array as the first argument to LPUSH and RPUSH after the key.
Expand Down Expand Up @@ -212,11 +219,7 @@ require('redis/lib/commands').forEach(function (command) {

Object.defineProperty(Client.prototype, command, {
value: function () {
var args = slice.call(arguments, 0);
if(args.length && Array.isArray(args[0])) {
return this.send(command, args.shift().concat(args));
}
return this.send(command, args);
return this.send(command, slice.call(arguments, 0));
}
});
});
Expand Down

0 comments on commit 4654012

Please sign in to comment.