<commit_before>var nowUtil = require('./nowUtil').nowUtil;
var ScopeTable = function (data) {
  this.data = data || {};
};

ScopeTable.prototype.get = function (fqn) {
  // does not reconstruct objects. :P
  return this.data[fqn];
};

ScopeTable.prototype.set = function (fqn, val) {
  var lastIndex = fqn.lastIndexOf('.');
  var parent = fqn.substring(0, lastIndex);
  if (parent && !Array.isArray(this.data[parent])) {
    this.set(parent, []); // Handle changing a non-object to an object.
  }
  if (parent && this.data[fqn] === undefined)
    this.data[parent].push(fqn.substring(lastIndex + 1));
  return this.data[fqn] = val;
};

ScopeTable.prototype.delete = function (fqn) {
  var lastIndex = fqn.lastIndexOf('.');
  var parent = fqn.substring(0, lastIndex);

  if(nowUtil.hasProperty(this.data, parent)){
    // Remove from its parent.
    this.data[parent].splice(
      this.data[parent].indexOf(fqn.substring(lastIndex + 1)),
      1);
  }

  if (Array.isArray(this.data[fqn])) {
    for (var i = 0; i < this.data[fqn].length; i++) {
      this.delete(fqn + '.' + this.data[fqn][i]);<commit_msg>Scope tables modified again: this time, handle objects being replaced with other objects.<commit_after>var nowUtil = require('./nowUtil').nowUtil;
var ScopeTable = function (data) {
  this.data = data || {};
};

ScopeTable.prototype.get = function (fqn) {
  // does not reconstruct objects. :P
  return this.data[fqn];
};

ScopeTable.prototype.set = function (fqn, val) {
  if (this.data[fqn] !== undefined)
    this.delete(fqn, val);
  var lastIndex = fqn.lastIndexOf('.');
  var parent = fqn.substring(0, lastIndex);
  if (parent && !Array.isArray(this.data[parent])) {
    this.set(parent, []); // Handle changing a non-object to an object.
  }
  if (parent && this.data[fqn] === undefined)
    this.data[parent].push(fqn.substring(lastIndex + 1));
  return this.data[fqn] = val;
};

ScopeTable.prototype.delete = function (fqn) {
  var lastIndex = fqn.lastIndexOf('.');
  var parent = fqn.substring(0, lastIndex);

  if(nowUtil.hasProperty(this.data, parent)){
    // Remove from its parent.
    this.data[parent].splice(
      this.data[parent].indexOf(fqn.substring(lastIndex + 1)),
      1);
  }

  if (Array.isArray(this.data[fqn])) {
    for (var i = 0; i < this.data[fqn].length; i++) {
      this.delete(fqn + '.' + this.data[fqn][i]);
{'fraction_non_alphanumeric': 0.17679558011049723, 'fraction_numerical': 0.005099872503187421, 'mean_word_length': 3.652173913043478, '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': '3662543', 'n_tokens_mistral': 854, 'n_tokens_neox': 815, 'n_words': 178}