<commit_before>/**
 * Dependencies.
 */

var co = require('co');

/**
 * Return whether `fn` is GeneratorFunction.
 *
 * @returns {Boolean}
 * @api private
 */

function isGenerator(fn) {
  return fn && fn.constructor && fn.constructor.name === 'GeneratorFunction';
}

/**
 * Add support for GeneratorFunctions.
 *
 * TODO: monkey patching Test.create is silly. We should expose
 * a public api for this.
 *
 * @param {Object} hydro
 * @api public
 */

module.exports = function(hydro) {
  var Test = hydro.constructor.Test;
  var createTest = Test.create;
  Test.create = function(params) {
    var fn = params[params.length - 1];
    var gen = null;

    if (isGenerator(fn)) {
      params.pop();

      gen = function(done) {
        co(function *() {
          yield fn();
          done();
        })();
      };
      params.push(gen);
    }

    return createTest(params);
  };
};<commit_msg>remove generator wrapper<commit_after>/**
 * Dependencies.
 */

var co = require('co');

/**
 * Return whether `fn` is GeneratorFunction.
 *
 * @returns {Boolean}
 * @api private
 */

function isGenerator(fn) {
  return fn && fn.constructor && fn.constructor.name === 'GeneratorFunction';
}

/**
 * Add support for GeneratorFunctions.
 *
 * TODO: monkey patching Test.create is silly. We should expose
 * a public api for this.
 *
 * @param {Object} hydro
 * @api public
 */

module.exports = function(hydro) {
  var Test = hydro.constructor.Test;
  var createTest = Test.create;
  Test.create = function(params) {
    var fn = params[params.length - 1];

    if (isGenerator(fn)) {
      params[params.length - 1] = co(fn);
    }

    return createTest(params);
  };
};
{'fraction_non_alphanumeric': 0.15089820359281436, 'fraction_numerical': 0.0017964071856287425, 'mean_word_length': 2.859122401847575, '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': '5031628', 'n_tokens_mistral': 532, 'n_tokens_neox': 517, 'n_words': 140}