<commit_before>const babel = require('babel-core').transform
const assign = require('object-assign')
const readPkg = require('read-pkg-up')

var BABEL_REGEX = /(^babel-)(preset|plugin)-(.*)/i

module.exports = function () {
  var cache
  return this.filter('babel', function (data, options) {
    if (options.preload) {
      delete options.preload

      var pkg = cache || (cache = readPkg.sync().pkg)
      var deps = Object.keys(pkg.devDependencies || {})

      deps.forEach(function (value) {
        var parsed = BABEL_REGEX.exec(value)
        if (parsed) {
          (options[parsed[2] + 's'] || (options[parsed[2] + 's'] = [])).push(parsed[3])
        }
      })
    }
    options.filename = options.file.base
    delete options.file
    return assign({ext: '.js'}, babel(data.toString(), options))
  })
}<commit_msg>replace const; slight improvement to aggregate<commit_after>var babel = require('babel-core').transform
var assign = require('object-assign')
var readPkg = require('read-pkg-up')

var BABEL_REGEX = /(^babel-)(preset|plugin)-(.*)/i

module.exports = function () {
  var cache
  return this.filter('babel', function (data, options) {
    if (options.preload) {
      delete options.preload

      var pkg = cache || (cache = readPkg.sync().pkg)
      var deps = Object.keys(pkg.devDependencies || {})

      deps.forEach(function (value) {
        var segs = BABEL_REGEX.exec(value)
        if (segs) {
          var key = (segs[2] + 's')
          options[key] = (options[key] || []).concat(segs[3])
        }
      })
    }
    options.filename = options.file.base
    delete options.file
    return assign({ext: '.js'}, babel(data.toString(), options))
  })
}
{'fraction_non_alphanumeric': 0.16775340841730882, 'fraction_numerical': 0.002963841138114997, 'mean_word_length': 3.0, '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': '4238221', 'n_tokens_mistral': 563, 'n_tokens_neox': 549, 'n_words': 115}