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 - remove standard and use individual config
Standard is not as up to date and still uses a old eslint version. Instead, use the airbnb default with a couple of modifications. All required changes are included.
This commit is contained in:
27
lib/utils.js
27
lib/utils.js
@ -6,12 +6,12 @@
|
||||
* @param {any[]} reply
|
||||
* @returns object
|
||||
*/
|
||||
function replyToObject (reply) {
|
||||
function replyToObject(reply) {
|
||||
if (reply.length === 0) {
|
||||
return null
|
||||
}
|
||||
const obj = {}
|
||||
for (let i = 0; i < reply.length; i += 2) {
|
||||
for (var i = 0; i < reply.length; i += 2) {
|
||||
obj[reply[i].toString('binary')] = reply[i + 1]
|
||||
}
|
||||
return obj
|
||||
@ -23,7 +23,7 @@ function replyToObject (reply) {
|
||||
* @param {any[]} reply
|
||||
* @returns any[]|string
|
||||
*/
|
||||
function replyToStrings (reply) {
|
||||
function replyToStrings(reply) {
|
||||
if (reply === null) {
|
||||
return null
|
||||
}
|
||||
@ -32,7 +32,7 @@ function replyToStrings (reply) {
|
||||
}
|
||||
if (typeof reply.map === 'function') { // instanceof Array
|
||||
const res = new Array(reply.length)
|
||||
for (let i = 0; i < reply.length; i++) {
|
||||
for (var i = 0; i < reply.length; i++) {
|
||||
// Recursively call the function as slowlog returns deep nested replies
|
||||
res[i] = replyToStrings(reply[i])
|
||||
}
|
||||
@ -51,7 +51,7 @@ function replyToStrings (reply) {
|
||||
* @param {any} obj
|
||||
* @returns any
|
||||
*/
|
||||
function clone (obj) {
|
||||
function clone(obj) {
|
||||
if (Array.isArray(obj)) {
|
||||
const copy = new Array(obj.length)
|
||||
for (var i = 0; i < obj.length; i++) {
|
||||
@ -81,7 +81,7 @@ function clone (obj) {
|
||||
* @param {undefined|object} obj
|
||||
* @returns object
|
||||
*/
|
||||
function convenienceClone (obj) {
|
||||
function convenienceClone(obj) {
|
||||
return clone(obj) || {}
|
||||
}
|
||||
|
||||
@ -99,7 +99,7 @@ function convenienceClone (obj) {
|
||||
* @param {any} res
|
||||
* @param {Denque} queue
|
||||
*/
|
||||
function replyInOrder (client, callback, err, res, queue) {
|
||||
function replyInOrder(client, callback, err, res, queue) {
|
||||
const commandObj = queue
|
||||
? queue.peekBack()
|
||||
: (client.offlineQueue.peekBack() || client.commandQueue.peekBack())
|
||||
@ -121,7 +121,7 @@ function replyInOrder (client, callback, err, res, queue) {
|
||||
* @param {RedisClient} client
|
||||
* @param {string} msg
|
||||
*/
|
||||
function warn (client, msg) {
|
||||
function warn(client, msg) {
|
||||
if (client.listeners('warning').length !== 0) {
|
||||
client.emit('warning', msg)
|
||||
} else {
|
||||
@ -140,8 +140,9 @@ function warn (client, msg) {
|
||||
* @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 === true) {
|
||||
function handleReply(client, reply, command) {
|
||||
if (client._options.detectBuffers === true && command.bufferArgs === false ||
|
||||
client._messageBuffers === true) {
|
||||
reply = replyToStrings(reply)
|
||||
}
|
||||
|
||||
@ -157,12 +158,12 @@ function handleReply (client, reply, command) {
|
||||
* @param {Error|null} err
|
||||
* @param {any} reply
|
||||
*/
|
||||
function print (err, reply) {
|
||||
function print(err, reply) {
|
||||
if (err) {
|
||||
// A error always begins with Error:
|
||||
console.error(err.toString())
|
||||
} else {
|
||||
console.log('Reply: ' + reply)
|
||||
console.log(`Reply: ${reply}`)
|
||||
}
|
||||
}
|
||||
|
||||
@ -171,7 +172,7 @@ function print (err, reply) {
|
||||
*
|
||||
* @param {RedisClient} client
|
||||
*/
|
||||
function setReconnectDefaults (client) {
|
||||
function setReconnectDefaults(client) {
|
||||
client.retryTimer = null
|
||||
client.retryTotaltime = 0
|
||||
client.retryDelay = 100
|
||||
|
Reference in New Issue
Block a user