<commit_before>
const deleteByDot = require('./delete-by-dot');
const _transformItems = require('./_transform-items');

module.exports = function (items /* modified */, fieldNames) {
  _transformItems(items, fieldNames, (item, fieldName, value) => {
    if (value !== undefined) {
      deleteByDot(item, fieldName);
    }
  });
};<commit_msg>Enable _remove to delete fields containing dots.<commit_after>
const deleteByDot = require('./delete-by-dot');
const _transformItems = require('./_transform-items');

module.exports = function (items /* modified */, fieldNames) {
  _transformItems(items, fieldNames, (item, fieldName, value) => {
    if (value !== undefined) {
      // Delete fields like item['contactPerson.name']. This is a typical patch format for MongoDB.
      if(item[fieldName]) delete item[fieldName];
      // Delete fields like item.contactPerson.name
      deleteByDot(item, fieldName);
    }
  });
};
{'fraction_non_alphanumeric': 0.14842903575297942, 'fraction_numerical': 0.0, 'mean_word_length': 4.076923076923077, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '7447872', 'n_tokens_mistral': 260, 'n_tokens_neox': 257, 'n_words': 69}