<commit_before>import command from './command';
import { IAction, ICommand, IValidate } from './types';
import * as fs from 'fs';
import * as fsPath from 'path';
import * as R from 'ramda';



const isDirectory = (path) => fs.lstatSync(path).isDirectory();



/**
 * Converts a parameter string passed to the module to a
 * set of module paths.
 */
function toModulePaths(param: string): Array<string> {
  let paths;
  param = param.endsWith('/') ? param += '*' : param;

  if (param.endsWith('*')) {
    // Wild-card, get all files in the folder.
    const dir = fsPath.resolve(fsPath.dirname(param));
    const items = fs
      .readdirSync(dir)
      .map(p => fsPath.join(dir, p));

    // Just the JS or TS files.
    paths = items.filter(p => p.endsWith('.js') || p.endsWith('.ts'));

    // Deep wild-card specified, search child-folders (RECURSION).
    if (param.endsWith('**')) {
      const children = items
        .filter(p => isDirectory(p))
        .map(p => toModulePaths(fsPath.join(p, '**')));
      paths.push(children);
      paths = R.flatten(paths);
    }

  } else {
    // A single path was specified.  Return it as a single-item array.<commit_msg>Do not include `.d.ts` files.<commit_after>import command from './command';
import { IAction, ICommand, IValidate } from './types';
import * as fs from 'fs';
import * as fsPath from 'path';
import * as R from 'ramda';



const isDirectory = (path) => fs.lstatSync(path).isDirectory();



/**
 * Converts a parameter string passed to the module to a
 * set of module paths.
 */
function toModulePaths(param: string): Array<string> {
  let paths;
  param = param.endsWith('/') ? param += '*' : param;

  if (param.endsWith('*')) {
    // Wild-card, get all files in the folder.
    const dir = fsPath.resolve(fsPath.dirname(param));
    const items = fs
      .readdirSync(dir)
      .map(p => fsPath.join(dir, p));

    // Just the JS or TS files.
    paths = items
      .filter(p => p.endsWith('.js') || (p.endsWith('.ts') && !p.endsWith('.d.ts')))

    // Deep wild-card specified, search child-folders (RECURSION).
    if (param.endsWith('**')) {
      const children = items
        .filter(p => isDirectory(p))
        .map(p => toModulePaths(fsPath.join(p, '**')));
      paths.push(children);
      paths = R.flatten(paths);
    }

  } else {
    // A single path was specified.  Return it as a single-item array.
{'fraction_non_alphanumeric': 0.16638795986622074, 'fraction_numerical': 0.0, 'mean_word_length': 2.8973941368078178, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, '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': '3455086', 'n_tokens_mistral': 782, 'n_tokens_neox': 765, 'n_words': 229}