<commit_before>import * as babel from 'babel-core';
import presetEs2015 from 'babel-preset-es2015';
import presetReact from 'babel-preset-react';
import { Observable } from 'rx';
/* eslint-disable import/no-unresolved */
import loopProtect from 'loop-protect';
/* eslint-enable import/no-unresolved */

import { updateContents } from '../../common/utils/polyvinyl';

const babelOptions = { presets: [ presetEs2015, presetReact ] };
loopProtect.hit = function hit(line) {
  var err = 'Exiting potential infinite loop at line ' +
    line +
    '. To disable loop protection, write: \n\/\/ noprotect\nas the first ' +
    'line. Beware that if you do have an infinite loop in your code, ' +
    'this will crash your browser.';
  throw new Error(err);
};

const transformersForHtmlJS = {
  ext: /html|js/,
  transformers: [
    {
      name: 'add-loop-protect',
      transformer: function addLoopProtect(file) {
        return updateContents(loopProtect(file.contents), file);
      }
    }
  ]
};

const transformersForJs = {
  ext: /js/,
  transformers: [
    {
      name: 'babel-transformer',
      transformer: function babelTransformer(file) {
        const result = babel.transform(file.contents, babelOptions);
        return updateContents(
          result.code,
          file
        );
      }
    }
  ]
};<commit_msg>Fix/Replace nbsp in campers code<commit_after>import * as babel from 'babel-core';
import presetEs2015 from 'babel-preset-es2015';
import presetReact from 'babel-preset-react';
import { Observable } from 'rx';
/* eslint-disable import/no-unresolved */
import loopProtect from 'loop-protect';
/* eslint-enable import/no-unresolved */

import { updateContents } from '../../common/utils/polyvinyl';

const babelOptions = { presets: [ presetEs2015, presetReact ] };
loopProtect.hit = function hit(line) {
  var err = 'Exiting potential infinite loop at line ' +
    line +
    '. To disable loop protection, write: \n\/\/ noprotect\nas the first ' +
    'line. Beware that if you do have an infinite loop in your code, ' +
    'this will crash your browser.';
  throw new Error(err);
};

const transformersForHtmlJS = {
  ext: /html|js/,
  transformers: [
    {
      name: 'add-loop-protect',
      transformer: function addLoopProtect(file) {
        return updateContents(loopProtect(file.contents), file);
      }
    },
    {
      name: 'replace-nbsp',
      nbspRegExp: new RegExp(String.fromCharCode(160), 'g'),
      transformer: function replaceNBSP(file) {
        return updateContents(
           file.contents.replace(this.nbspRegExp, ' '),
           file
         );
      }
    }
  ]
};

const transformersForJs = {
  ext: /js/,
  transformers: [
    {
      name: 'babel-transformer',
      transformer: function babelTransformer(file) {
        const result = babel.transform(file.contents, babelOptions);
        return updateContents(
          result.code,
          file
        );
      }
    }
  ]
};
{'fraction_non_alphanumeric': 0.12398373983739837, 'fraction_numerical': 0.009146341463414634, 'mean_word_length': 2.8054123711340204, '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': '2867683', 'n_tokens_mistral': 942, 'n_tokens_neox': 910, 'n_words': 231}