<commit_before>module.exports = (sftp, mongo) => {
  const sftpIndex = (sftp && sftp.length)
    ? sftp.map(f => f.path)
    : [];
  const mongoIndex = (mongo && mongo.length)
    ? mongo.map(f => f.path)
    : [];

  let added = sftpIndex.filter((x) => mongoIndex.indexOf(x) === -1);
  let removed = mongoIndex.filter((x) => sftpIndex.indexOf(x) === -1);

  if (added && added.length) {
    added = sftp.filter((f) => added.indexOf(f.path) !== -1);
  }
  if (removed && removed.length) {
    removed = mongo.filter((f) => removed.indexOf(f.path) !== -1);
  }

  return {
    added,
    removed,
  };
};<commit_msg>Added debug logging in syncDiff task<commit_after>const debug = require('./debug');

module.exports = (sftp, mongo) => {
  const sftpIndex = (sftp && sftp.length)
    ? sftp.map(f => f.path)
    : [];
  const mongoIndex = (mongo && mongo.length)
    ? mongo.map(f => f.path)
    : [];

  // added
  let added = sftpIndex.filter((x) => {
    const r = (mongoIndex.indexOf(x) === -1);
    if (r) {
      debug(`DIFF :: added ${x}`);
    }
    return r;
  });
  if (added && added.length) {
    added = sftp.filter((f) => added.indexOf(f.path) !== -1);
  }

  // removed
  let removed = mongoIndex.filter((x) => {
    const r = (sftpIndex.indexOf(x) === -1);
    if (r) {
      debug(`DIFF :: removed ${x}`);
    }
    return r;
  });
  if (removed && removed.length) {
    removed = mongo.filter((f) => removed.indexOf(f.path) !== -1);
  }

  return {
    added,
    removed,
  };
};
{'fraction_non_alphanumeric': 0.21256684491978609, 'fraction_numerical': 0.0053475935828877, 'mean_word_length': 2.624697336561743, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, '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': '865140', 'n_tokens_mistral': 588, 'n_tokens_neox': 573, 'n_words': 112}