<commit_before>var obj = require("object-path");

function getCaller (node) {
  var o, p;
  if (obj.get(node, "type") === "MemberExpression") {
    o = obj.get(node, "object.type") === "MemberExpression" ? getCaller(node.object) : obj.get(node, "object.name");
    p = obj.get(node, "property.name") || obj.get(node, "property.value");
    return p ? o + "." + p : o;
  }
  var callee = obj.get(node, "callee");
  if (!callee) {
    return "";
  }
  if (obj.get(callee, "type") === "MemberExpression") {
    o = obj.get(callee, "object.type") === "MemberExpression" ? getCaller(callee.object) : obj.get(callee, "object.name");
    p = obj.get(callee, "property.name") || obj.get(callee, "property.value");
    return p ? o + "." + p : o;
  }
  return obj.get(callee, "name");
}

function _endsWith (str, suffix) {
  return str.indexOf(suffix, str.length - suffix.length) !== -1;
}

function cleanCaller (caller) {
  [".call", ".apply"].forEach(function (e) {
    if (_endsWith(caller, e)) {
      var i = caller.lastIndexOf(e);
      caller = caller.substr(0, i);
    }
  });
  return caller;
}

module.exports = {
  getCaller: getCaller,
  cleanCaller: cleanCaller
};<commit_msg>Fix for `cleanCaller`<commit_after>var obj = require("object-path");

function getCaller (node) {
  var o, p;
  if (obj.get(node, "type") === "MemberExpression") {
    o = obj.get(node, "object.type") === "MemberExpression" ? getCaller(node.object) : obj.get(node, "object.name");
    p = obj.get(node, "property.name") || obj.get(node, "property.value");
    return p ? o + "." + p : o;
  }
  var callee = obj.get(node, "callee");
  if (!callee) {
    return "";
  }
  if (obj.get(callee, "type") === "MemberExpression") {
    o = obj.get(callee, "object.type") === "MemberExpression" ? getCaller(callee.object) : obj.get(callee, "object.name");
    p = obj.get(callee, "property.name") || obj.get(callee, "property.value");
    return p ? o + "." + p : o;
  }
  return obj.get(callee, "name");
}

function _endsWith (str, suffix) {
  return str.indexOf(suffix, str.length - suffix.length) !== -1;
}

function cleanCaller (caller) {
  if (!caller) {
    return caller;
  }
  [".call", ".apply"].forEach(function (e) {
    if (_endsWith(caller, e)) {
      var i = caller.lastIndexOf(e);
      caller = caller.substr(0, i);
    }
  });
  return caller;
}

module.exports = {
  getCaller: getCaller,
  cleanCaller: cleanCaller
};
{'fraction_non_alphanumeric': 0.2009966777408638, 'fraction_numerical': 0.0016611295681063123, 'mean_word_length': 3.502803738317757, 'pattern_counts': {'":': 0, '<': 3, '<?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': '3780013', 'n_tokens_mistral': 895, 'n_tokens_neox': 890, 'n_words': 190}