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

chore: refactor main code into smaller parts

This commit is contained in:
Ruben Bridgewater
2017-05-27 03:41:27 +02:00
parent be3976e8ba
commit 2aa3b68fc6
9 changed files with 205 additions and 190 deletions

View File

@@ -6,6 +6,9 @@ const net = require('net')
const reconnect = require('./reconnect')
const onConnect = require('./readyHandler')
const debug = require('./debug')
const replyHandler = require('./replyHandler')
const onResult = replyHandler.onResult
const onError = replyHandler.onError
/**
* @description Create a new Parser instance and pass all the necessary options to it
@@ -16,10 +19,10 @@ const debug = require('./debug')
function createParser (client) {
return new Parser({
returnReply (data) {
client.returnReply(data)
onResult(client, data)
},
returnError (err) {
client.returnError(err)
onError(client, err)
},
returnFatalError (err) {
// Error out all fired commands. Otherwise they might rely on faulty data. We have to reconnect to get in a working state again