<commit_before>// Dependencies
var crypto = require('crypto');

// Includes
var http = require('./http.js').func;
var getSession = require('./getSession.js').func;
var options = require('../options.js');
var cache = require('../cache');

// Args
exports.required = ['group'];
exports.optional = ['jar'];

// Define
function getRolesetInGroupWithJar (jar, group) {
  return function (resolve, reject) {
    var httpOpt = {
      url: '//www.roblox.com/My/Groups.aspx?gid=' + group,
      options: {
        jar: jar
      }
    };
    http(httpOpt)
    .then(function (body) {
      resolve(parseInt(body.match(/InitializeGlobalVars\((.*), /)[1], 10));
    });
  };
}

exports.func = function (args) {
  var jar = args.jar || options.jar;
  var session = getSession({jar: jar});
  var hash = crypto.createHash('md5').update(session).digest('hex');
  return cache.wrap('RolesetId', hash, getRolesetInGroupWithJar(jar, args.group));
};
<commit_msg>Use getHash<commit_after>// Includes
var http = require('./http.js').func;
var getHash = require('./getHash.js').func;
var cache = require('../cache');

// Args
exports.required = ['group'];
exports.optional = ['jar'];

// Define
function getRolesetInGroupWithJar (jar, group) {
  return function (resolve, reject) {
    var httpOpt = {
      url: '//www.roblox.com/My/Groups.aspx?gid=' + group,
      options: {
        jar: jar
      }
    };
    http(httpOpt)
    .then(function (body) {
      resolve(parseInt(body.match(/InitializeGlobalVars\((.*), /)[1], 10));
    });
  };
}

exports.func = function (args) {
  var jar = args.jar;
  return cache.wrap('RolesetId', getHash({jar: jar}), getRolesetInGroupWithJar(jar, args.group));
};

{'fraction_non_alphanumeric': 0.19121140142517815, 'fraction_numerical': 0.004156769596199525, 'mean_word_length': 3.3994778067885116, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '4250504', 'n_tokens_mistral': 571, 'n_tokens_neox': 566, 'n_words': 117}