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

chore: refactor parts out of the index.js file

This commit is contained in:
Ruben Bridgewater
2017-05-26 18:45:52 +02:00
parent a3a74559da
commit 3065e2e7be
19 changed files with 271 additions and 281 deletions

View File

@@ -115,11 +115,26 @@ function replyInOrder (client, callback, err, res, queue) {
}
}
/**
* @description Emit or print a warning. E.g. deprecations
*
* @param {RedisClient} client
* @param {string} msg
*/
function warn (client, msg) {
if (client.listeners('warning').length !== 0) {
client.emit('warning', msg)
} else {
console.warn('NodeRedis:', msg)
}
}
module.exports = {
replyToStrings,
replyToObject,
errCode: /^([A-Z]+)\s+(.+)$/,
monitorRegex: /^[0-9]{10,11}\.[0-9]+ \[[0-9]+ .+]( ".+?")+$/,
clone: convenienceClone,
replyInOrder
replyInOrder,
warn
}