lib/parser.js
function parseSimpleNumbers (parser) {
  const length = parser.buffer.length - 1
  var offset = parser.offset
  var number = 0
  var sign = 1

  if (parser.buffer[offset] === 45) {
    sign = -1
    offset++
  }

  while (offset < length) {
    const c1 = parser.buffer[offset++]
    if (c1 === 13) { // \r\n
      parser.offset = offset + 1
      return sign * number
    }
    number = (number * 10) + (c1 - 48)
  }
}
function parseSimpleNumbers (parser) {
  const length = parser.buffer.length - 1
  var offset = parser.offset
  var number = 0
  var sign = 1

  if (parser.buffer[offset] === 45) {
    sign = -1
    offset++
  }

  while (offset < length) {
    const c1 = parser.buffer[offset++]
    if (c1 === 13) { // \r\n
      parser.offset = offset + 1
      return sign * number
    }
    number = (number * 10) + (c1 - 48)
  }
}
function parseSimpleNumbers ( parser ) { const length = parser . buffer . length - 1 var offset = parser . offset var number = 0 var sign = 1 if ( parser . buffer [ offset ] === 45 ) { sign = - 1 offset ++ } while ( offset < length ) { const c1 = parser . buffer [ offset ++ ] if ( c1 === 13 ) { // \r\n parser . offset = offset + 1 return sign * number } number = ( number * 10 ) + ( c1 - 48 ) } }
Used for integer numbers only
@param {JavascriptRedisParser} parser
@returns {undefined|number}
Used for integer numbers only