lib/scanner.js
function scan(req, res) {
  var records = []
    , position
    , i
    , key
    , inc
    , map = this.map
    , len = this.cursor + this.count;

  for(i = this.cursor; i < len;i++) {
    if(i === this.target.length) {
      position = 0;
      break;
    }
    key = '' + this.target[i];
    inc = !this.pattern || (this.pattern && this.pattern.test(key));
    if(inc) {
      records.push(key);
      if(map) records.push(this.stringify ? '' + map[key] : map[key]);
    }
    position = i + 1;
  }

  res.send(null, [position, records]);
}
function scan(req, res) {
  var records = []
    , position
    , i
    , key
    , inc
    , map = this.map
    , len = this.cursor + this.count;

  for(i = this.cursor; i < len;i++) {
    if(i === this.target.length) {
      position = 0;
      break;
    }
    key = '' + this.target[i];
    inc = !this.pattern || (this.pattern && this.pattern.test(key));
    if(inc) {
      records.push(key);
      if(map) records.push(this.stringify ? '' + map[key] : map[key]);
    }
    position = i + 1;
  }

  res.send(null, [position, records]);
}
function scan ( req , res ) { var records = [ ] , position , i , key , inc , map = this . map , len = this . cursor + this . count ; for ( i = this . cursor ; i < len ; i ++ ) { if ( i === this . target . length ) { position = 0 ; break ; } key = '' + this . target [ i ] ; inc = ! this . pattern || ( this . pattern && this . pattern . test ( key ) ) ; if ( inc ) { records . push ( key ) ; if ( map ) records . push ( this . stringify ? '' + map [ key ] : map [ key ] ) ; } position = i + 1 ; } res . send ( null , [ position , records ] ) ; }
Perform the scan and send the response to the client.
Perform the scan and send the response to the client .