You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-04 15:02:09 +03:00
chore: improve multi performance by refactoring a array check away
This commit is contained in:
11
lib/utils.js
11
lib/utils.js
@ -3,18 +3,11 @@
|
||||
/**
|
||||
* @description Convert an array to an object
|
||||
*
|
||||
* hgetall converts its replies to an object. If the reply is empty, null is returned.
|
||||
* The reply might be a string or a buffer if this is called in a transaction (multi)
|
||||
* because of the queuing response.
|
||||
*
|
||||
* reply.length can be undefined but `undefined > 0` === false.
|
||||
*
|
||||
* @param {any} reply
|
||||
* @param {any[]} reply
|
||||
* @returns object
|
||||
*/
|
||||
function replyToObject (reply) {
|
||||
// The reply might be a string or a buffer if this is called in a transaction (multi)
|
||||
if (reply.length === 0 || !(reply instanceof Array)) {
|
||||
if (reply.length === 0) {
|
||||
return null
|
||||
}
|
||||
const obj = {}
|
||||
|
Reference in New Issue
Block a user