<commit_before>import { Smartfile } from './smartfile.classes.smartfile';
import * as plugins from './smartfile.plugins';
import * as fs from './smartfile.fs';

/**
 * a virtual directory exposes a fs api
 */
export class VirtualDirectory {
  private fileArray: Smartfile[] = [];
  public static async fromFsDirPath(pathArg: string) {
    const newVirtualDir = new VirtualDirectory();
    newVirtualDir.addSmartfiles(await fs.fileTreeToObject(pathArg, '**/*'));
  }

  constructor() {}

  public addSmartfiles(smartfileArrayArg: Smartfile[]) {
    this.fileArray = this.fileArray.concat(smartfileArrayArg);
  }

  public async getFileByPath(pathArg: string) {
    for (const smartfile of this.fileArray) {
      if (smartfile.path === pathArg) {
        return smartfile;
      }
    }
  }

  // TODO implement root shifting to get subdirectories as new virtual directories
  // TODO implement root shifting to combine VirtualDirecotries in a parent virtual directory
}<commit_msg>fix(core): update<commit_after>import { Smartfile } from './smartfile.classes.smartfile';
import * as plugins from './smartfile.plugins';
import * as fs from './smartfile.fs';

/**
 * a virtual directory exposes a fs api
 */
export class VirtualDirectory {
  private fileArray: Smartfile[] = [];
  public static async fromFsDirPath(pathArg: string) {
    const newVirtualDir = new VirtualDirectory();
    newVirtualDir.addSmartfiles(await fs.fileTreeToObject(pathArg, '**/*'));
    return newVirtualDir;
  }

  constructor() {}

  public addSmartfiles(smartfileArrayArg: Smartfile[]) {
    this.fileArray = this.fileArray.concat(smartfileArrayArg);
  }

  public async getFileByPath(pathArg: string) {
    for (const smartfile of this.fileArray) {
      if (smartfile.path === pathArg) {
        return smartfile;
      }
    }
  }

  // TODO implement root shifting to get subdirectories as new virtual directories
  // TODO implement root shifting to combine VirtualDirecotries in a parent virtual directory
}
{'fraction_non_alphanumeric': 0.10742971887550201, 'fraction_numerical': 0.0, 'mean_word_length': 3.9088669950738915, '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': '2259897', 'n_tokens_mistral': 572, 'n_tokens_neox': 552, 'n_words': 165}