<commit_before>'use strict';

var path = require('path');
var util = require('util');
var cyan = require('ansi-cyan');
var argv = require('minimist')(process.argv.slice(2));
var isPrimitive = require('is-primitive');
var isObject = require('is-object');
var Suite = require('benchmarked');

function run(type, pattern) {
  var suite = new Suite({
    cwd: __dirname,
    fixtures: path.join('fixtures', type, '*.js'),
    code: path.join('code', type, '*.js')
  });

  if (argv.dry) {
    console.log(type);
    suite.dryRun(function(code, fixture) {
      console.log(cyan('%s > %s'), code.key, fixture.key);
      var args = require(fixture.path);
      var last = [];
      if (args.length > 2) {
        last = args.pop();
      }
      var expected = util.inspect(last, {depth: null});
      console.log(util.inspect(code.run.apply(null, args), {depth: null}));
      console.log();
    });
  } else {
    suite.run();
  }
}

run(argv._[0] || 'match');<commit_msg>use yargs<commit_after>'use strict';

var path = require('path');
var util = require('util');
var cyan = require('ansi-cyan');
var argv = require('yargs-parser')(process.argv.slice(2));
var isPrimitive = require('is-primitive');
var isObject = require('is-object');
var Suite = require('benchmarked');

function run(type, pattern) {
  var suite = new Suite({
    cwd: __dirname,
    fixtures: path.join('fixtures', type, '*.js'),
    code: path.join('code', type, '*.js')
  });

  if (argv.dry) {
    console.log(type);
    suite.dryRun(function(code, fixture) {
      console.log(cyan('%s > %s'), code.key, fixture.key);
      var args = require(fixture.path);
      var last = [];
      if (args.length > 2) {
        last = args.pop();
      }
      var expected = util.inspect(last, {depth: null});
      console.log(util.inspect(code.run.apply(null, args), {depth: null}));
      console.log();
    });
  } else {
    suite.run();
  }
}

run(argv._[0] || 'match');
{'fraction_non_alphanumeric': 0.1996904024767802, 'fraction_numerical': 0.0030959752321981426, 'mean_word_length': 3.318485523385301, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '4966229', 'n_tokens_mistral': 676, 'n_tokens_neox': 665, 'n_words': 146}