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

Support __proto__ and similar as object attribute in hgetall

This commit is contained in:
Ruben Bridgewater
2016-04-13 03:48:33 +02:00
parent a11e0c5ff9
commit 228573b8d7
4 changed files with 25 additions and 37 deletions

View File

@@ -1,5 +1,7 @@
'use strict';
var RawObject = require('./rawObject');
// hgetall converts its replies to an Object. If the reply is empty, null is returned.
// These function are only called with internal data and have therefor always the same instanceof X
function replyToObject (reply) {
@@ -7,7 +9,7 @@ function replyToObject (reply) {
if (reply.length === 0 || !(reply instanceof Array)) {
return null;
}
var obj = {};
var obj = new RawObject();
for (var i = 0; i < reply.length; i += 2) {
obj[reply[i].toString('binary')] = reply[i + 1];
}