<commit_before>var redis = require("redis");

function get(hash, key, default_value) { 
  if (key in hash) { return key }
  else { return default_value }
}

function Leaderboard(leaderboard_name, options) {
  if (undefined == options) { options = {} }
  VERSION = '1.1.4'
  DEFAULT_PAGE_SIZE = 25
  DEFAULT_REDIS_HOST = 'localhost'
  DEFAULT_REDIS_PORT = 6379
  DEFAULT_REDIS_DB = 0

  page_size = get(options, 'page_size', DEFAULT_PAGE_SIZE)
  if (page_size < 1) { page_size = DEFAULT_PAGE_SIZE }

  rhost = get(options, 'host', DEFAULT_REDIS_HOST)
  rport = get(options, 'port', DEFAULT_REDIS_PORT)
  rdb   = get(options, 'db',   DEFAULT_REDIS_DB)

  var rcl = redis.createClient(rport, rhost);

  return {
    leaderboard_name : leaderboard_name, 
    options : JSON.parse(JSON.stringify(options)),
    use_zero_index_for_rank: get(options, 'use_zero_index_for_rank', false),
    page_size : page_size,
    redis_connection : rcl,
    onConnect : function(callback) {
      this.redis_connection.stream.addListener("connect", callback)    
    },

    rank_member : function(member, score, callback) { this.redis_connection.zadd(this.leaderboard_name, score, member, function(err, reply) {
      if ("function" == typeof callback) { callback(err, reply); }
    }) },
<commit_msg>Correcting version to be inline with package.json<commit_after>var redis = require("redis");

function get(hash, key, default_value) { 
  if (key in hash) { return key }
  else { return default_value }
}

function Leaderboard(leaderboard_name, options) {
  if (undefined == options) { options = {} }
  VERSION = '0.0.1'
  DEFAULT_PAGE_SIZE = 25
  DEFAULT_REDIS_HOST = 'localhost'
  DEFAULT_REDIS_PORT = 6379
  DEFAULT_REDIS_DB = 0

  page_size = get(options, 'page_size', DEFAULT_PAGE_SIZE)
  if (page_size < 1) { page_size = DEFAULT_PAGE_SIZE }

  rhost = get(options, 'host', DEFAULT_REDIS_HOST)
  rport = get(options, 'port', DEFAULT_REDIS_PORT)
  rdb   = get(options, 'db',   DEFAULT_REDIS_DB)

  var rcl = redis.createClient(rport, rhost);

  return {
    leaderboard_name : leaderboard_name, 
    options : JSON.parse(JSON.stringify(options)),
    use_zero_index_for_rank: get(options, 'use_zero_index_for_rank', false),
    page_size : page_size,
    redis_connection : rcl,
    onConnect : function(callback) {
      this.redis_connection.stream.addListener("connect", callback)    
    },

    rank_member : function(member, score, callback) { this.redis_connection.zadd(this.leaderboard_name, score, member, function(err, reply) {
      if ("function" == typeof callback) { callback(err, reply); }
    }) },

{'fraction_non_alphanumeric': 0.11961538461538461, 'fraction_numerical': 0.008461538461538461, 'mean_word_length': 4.351851851851852, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3896064', 'n_tokens_mistral': 905, 'n_tokens_neox': 869, 'n_words': 186}