<commit_before>/* eslint-disable no-param-reassign */
const ENVIRONMENTS = require('../../../constants/environments');

function createEnvironmentFilter(options) {
  const environmentName = options.buildtype;

  return (files, metalsmith, done) => {
    for (const fileName of Object.keys(files)) {
      const file = files[fileName];

      if (environmentName !== ENVIRONMENTS.LOCALHOST) {
        if (file.draft) delete files[fileName];
      }

      if (file[environmentName] === false) {
        delete files[fileName];
      }
    }
    done();
  };
}

module.exports = createEnvironmentFilter;
<commit_msg>Change draft to status (#9773)<commit_after>/* eslint-disable no-param-reassign */
const ENVIRONMENTS = require('../../../constants/environments');

function createEnvironmentFilter(options) {
  const environmentName = options.buildtype;

  return (files, metalsmith, done) => {
    for (const fileName of Object.keys(files)) {
      const file = files[fileName];

      if (environmentName !== ENVIRONMENTS.LOCALHOST) {
        if (file.status === 'draft') {
          delete files[fileName];
        }
      }

      if (file[environmentName] === false) {
        delete files[fileName];
      }
    }
    done();
  };
}

module.exports = createEnvironmentFilter;

{'fraction_non_alphanumeric': 0.140625, 'fraction_numerical': 0.003125, 'mean_word_length': 3.0410094637223977, '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': '3017134', 'n_tokens_mistral': 380, 'n_tokens_neox': 371, 'n_words': 81}