1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-06 02:15:48 +03:00

Implemented HGETALL response as object

This commit is contained in:
Tj Holowaychuk
2010-09-17 14:52:32 -07:00
parent 0b3a1c3eaa
commit bcbf3834e1
2 changed files with 11 additions and 1 deletions

View File

@@ -412,6 +412,16 @@ RedisClient.prototype.return_reply = function (reply_buffer) {
var command_obj = this.command_queue.shift();
if (command_obj && typeof command_obj.callback === "function") {
// HGETALL special case replies with keyed Buffers
if ('HGETALL' == command_obj.command) {
var obj = {};
for (var i = 0, len = reply_buffer.length; i < len; ++i) {
var key = reply_buffer[i].toString(),
val = reply_buffer[++i];
obj[key] = val;
}
reply_buffer = obj;
}
command_obj.callback(null, reply_buffer);
} else {
if (this.debug_mode) {