<commit_before>// Includes
var http = require('./http.js').func;
var cache = require('../cache');

// Args
exports.required = ['group', 'userId'];

// Define
function getRankInGroup (group, userId) {
  return function (resolve, reject) {
    http({url: '//www.roblox.com/Game/LuaWebService/HandleSocialRequest.ashx?method=GetGroupRank&playerid=' + userId + '&groupId=' + group})
    .then(function (body) {
      // Efficient
      resolve(parseInt(body.substring(22), 10));
    });
  };
}

exports.func = function (args) {
  var id = args.userId;
  return cache.wrap('Rank', id, getRankInGroup(args.group, id));
};<commit_msg>Simplify<commit_after>// Includes
var http = require('./http.js').func;
var cache = require('../cache');

// Args
exports.required = ['group', 'userId'];

// Define
function getRankInGroup (group, userId) {
  return http({url: '//www.roblox.com/Game/LuaWebService/HandleSocialRequest.ashx?method=GetGroupRank&playerid=' + userId + '&groupId=' + group})
  .then(function (body) {
    // Efficient
    return parseInt(body.substring(22), 10);
  });
}

exports.func = function (args) {
  var id = args.userId;
  return cache.wrap('Rank', id, function () {
    return getRankInGroup(args.group, id);
  });
};
{'fraction_non_alphanumeric': 0.18602761982128352, 'fraction_numerical': 0.006498781478472786, 'mean_word_length': 4.049180327868853, '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': '5752476', 'n_tokens_mistral': 415, 'n_tokens_neox': 412, 'n_words': 84}