<commit_before>'use strict';

const tryCatch = require('try-catch');
const squad = require('squad');
const currify = require('currify');

const find = require('../find');
const ifNotFound = require('../if-not-found');
const addDirectory = currify(require('../directory').add);

module.exports = (runners, fn, runItem) => {
    const name = runItem.name;
    const cwd = runItem.cwd;
    const add = squad.apply(null, [
        addDirectory(name, cwd),
        ifNotFound(name)
    ]);
    
    let result;
    const error = tryCatch(() => {
        checkName(name);
        result = add(runners);
    });
    
    fn(error, result);
};

function checkName(name) {
    if (!name)
        throw Error('name could not be empty');
}

<commit_msg>chore(add) rm unused find<commit_after>'use strict';

const tryCatch = require('try-catch');
const squad = require('squad');
const currify = require('currify');

const ifNotFound = require('../if-not-found');
const addDirectory = currify(require('../directory').add);

module.exports = (runners, fn, runItem) => {
    const name = runItem.name;
    const cwd = runItem.cwd;
    const add = squad.apply(null, [
        addDirectory(name, cwd),
        ifNotFound(name)
    ]);
    
    let result;
    const error = tryCatch(() => {
        checkName(name);
        result = add(runners);
    });
    
    fn(error, result);
};

function checkName(name) {
    if (!name)
        throw Error('name could not be empty');
}


{'fraction_non_alphanumeric': 0.1619958988380041, 'fraction_numerical': 0.0, 'mean_word_length': 2.967479674796748, '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': '1310825', 'n_tokens_mistral': 463, 'n_tokens_neox': 465, 'n_words': 112}