lib/scanner.js
function Scanner(target, cursor, pattern, count, map, stringify) {
  this.target = target;
  this.cursor = cursor;
  this.pattern = pattern;
  this.count = count || 10;
  this.map = map;
  this.stringify = stringify;

  // clamp the count
  this.count = Math.max(this.count, 10);
  this.count = Math.min(this.count, 1000);
}
function Scanner(target, cursor, pattern, count, map, stringify) {
  this.target = target;
  this.cursor = cursor;
  this.pattern = pattern;
  this.count = count || 10;
  this.map = map;
  this.stringify = stringify;

  // clamp the count
  this.count = Math.max(this.count, 10);
  this.count = Math.min(this.count, 1000);
}
function Scanner ( target , cursor , pattern , count , map , stringify ) { this . target = target ; this . cursor = cursor ; this . pattern = pattern ; this . count = count || 10 ; this . map = map ; this . stringify = stringify ; // clamp the count this . count = Math . max ( this . count , 10 ) ; this . count = Math . min ( this . count , 1000 ) ; }
Encapsulates the scan logic.

@param target The target array of keys.
@param cursor The user-supplied cursor position.
@param pattern A regular expression pattern if match was specified.
@param count A user-specified count option.
@param map An object used to lookup values (hscan and zscan).
@param stringify Convert map values to strings (zscan).
Encapsulates the scan logic .