index.js
function handleResponse(conn, cb, opts) {
    opts = opts || {};

    return function(err, result) {
      pool.release(conn);

      if (err) {
        return cb && cb(err);
      }

      if (opts.parse) {

        if (result && opts.compress) {
          return zlib.gunzip(result, opts.compress.params || {}, function (gzErr, gzResult) {
            if (gzErr) {
              return cb && cb(gzErr);
            }
            try {
              gzResult = JSON.parse(gzResult);
            } catch (e) {
              return cb && cb(e);
            }

            return cb && cb(null, gzResult);
          });
        }

        try {
          result = JSON.parse(result);
        } catch (e) {
          return cb && cb(e);
        }
      }

      return cb && cb(null, result);
    };
  }
function handleResponse(conn, cb, opts) {
    opts = opts || {};

    return function(err, result) {
      pool.release(conn);

      if (err) {
        return cb && cb(err);
      }

      if (opts.parse) {

        if (result && opts.compress) {
          return zlib.gunzip(result, opts.compress.params || {}, function (gzErr, gzResult) {
            if (gzErr) {
              return cb && cb(gzErr);
            }
            try {
              gzResult = JSON.parse(gzResult);
            } catch (e) {
              return cb && cb(e);
            }

            return cb && cb(null, gzResult);
          });
        }

        try {
          result = JSON.parse(result);
        } catch (e) {
          return cb && cb(e);
        }
      }

      return cb && cb(null, result);
    };
  }
function handleResponse ( conn , cb , opts ) { opts = opts || { } ; return function ( err , result ) { pool . release ( conn ) ; if ( err ) { return cb && cb ( err ) ; } if ( opts . parse ) { if ( result && opts . compress ) { return zlib . gunzip ( result , opts . compress . params || { } , function ( gzErr , gzResult ) { if ( gzErr ) { return cb && cb ( gzErr ) ; } try { gzResult = JSON . parse ( gzResult ) ; } catch ( e ) { return cb && cb ( e ) ; } return cb && cb ( null , gzResult ) ; } ) ; } try { result = JSON . parse ( result ) ; } catch ( e ) { return cb && cb ( e ) ; } } return cb && cb ( null , result ) ; } ; }
Helper to handle callback and release the connection
@private
@param {Object} conn - The Redis connection
@param {Function} [cb] - A callback that returns a potential error and the result
@param {Object} [opts] - The options (optional)
Helper to handle callback and release the connection