You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-06 02:15:48 +03:00
chore: refactor main code base into smaller parts
This commit is contained in:
25
lib/utils.js
25
lib/utils.js
@@ -129,6 +129,28 @@ function warn (client, msg) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Transform the reply as needed.
|
||||
*
|
||||
* If detectBuffers option was specified, then the reply from the parser will be a buffer.
|
||||
* If this command did not use Buffer arguments, then convert the reply to Strings here.
|
||||
*
|
||||
* @param {RedisClient} client
|
||||
* @param {string|number|null|Buffer|any[]} reply
|
||||
* @param {Command} command
|
||||
* @returns {string|number|null|Buffer|any[]|object}
|
||||
*/
|
||||
function handleReply (client, reply, command) {
|
||||
if (client.options.detectBuffers === true && command.bufferArgs === false) { // client.messageBuffers
|
||||
reply = replyToStrings(reply)
|
||||
}
|
||||
|
||||
if (command.command === 'hgetall') {
|
||||
reply = replyToObject(reply)
|
||||
}
|
||||
return reply
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
replyToStrings,
|
||||
replyToObject,
|
||||
@@ -136,5 +158,6 @@ module.exports = {
|
||||
monitorRegex: /^[0-9]{10,11}\.[0-9]+ \[[0-9]+ .+]( ".+?")+$/,
|
||||
clone: convenienceClone,
|
||||
replyInOrder,
|
||||
warn
|
||||
warn,
|
||||
handleReply
|
||||
}
|
||||
|
Reference in New Issue
Block a user