<commit_before>'use babel';

import path from 'path';
import fs from 'fs-plus';

import fileTypes from './file-types';

const iconBinary = 'icon-file-binary';
const iconCode = 'icon-file-code';
const iconMedia = 'icon-file-media';
const iconPdf = 'icon-file-pdf';
const iconSymlink = 'icon-file-symlink-file';
const iconText = 'icon-file-text';
const iconZip = 'icon-file-zip';
const iconDatabase = 'icon-database';

export default class File {
  constructor(filePath) {
    this.filePath = filePath || '';
    this.extension = path.extname(this.filePath);
    this.fileName = path.basename(this.filePath, this.extension);
    this.fileType = this.extension.substring(1) || this.fileName;
  }

  iconClass() {
    if (fs.isSymbolicLinkSync(this.filePath)) {
      return iconSymlink;
    } else if (fs.isCompressedExtension(this.extension)) {
      return iconZip;
    } else if (fs.isImageExtension(this.extension)) {
      return iconMedia;
    } else if (fs.isPdfExtension(this.extension)) {
      return iconPdf;
    } else if (fs.isBinaryExtension(this.extension)) {
      return iconBinary;
    } else if (fs.isMarkdownExtension(this.extension)) {
      return iconText;
    } else if (this.isDatabase()) {
      return iconDatabase;
    } else if (this.isCodeExtension()) {
      return iconCode;
    }
    return iconText;
  }

  isCodeExtension() {
    return fileTypes.source.includes(this.fileType);
  }

  isDatabase() {<commit_msg>Add "book" icon for MD files<commit_after>'use babel';

import path from 'path';
import fs from 'fs-plus';

import fileTypes from './file-types';

const iconBinary = 'icon-file-binary';
const iconCode = 'icon-file-code';
const iconMedia = 'icon-file-media';
const iconPdf = 'icon-file-pdf';
const iconSymlink = 'icon-file-symlink-file';
const iconText = 'icon-file-text';
const iconZip = 'icon-file-zip';
const iconDatabase = 'icon-database';
const iconBook = 'icon-book';

export default class File {
  constructor(filePath) {
    this.filePath = filePath || '';
    this.extension = path.extname(this.filePath);
    this.fileName = path.basename(this.filePath, this.extension);
    this.fileType = this.extension.substring(1) || this.fileName;
  }

  iconClass() {
    if (fs.isSymbolicLinkSync(this.filePath)) {
      return iconSymlink;
    } else if (fs.isCompressedExtension(this.extension)) {
      return iconZip;
    } else if (fs.isImageExtension(this.extension)) {
      return iconMedia;
    } else if (fs.isPdfExtension(this.extension)) {
      return iconPdf;
    } else if (fs.isBinaryExtension(this.extension)) {
      return iconBinary;
    } else if (fs.isMarkdownExtension(this.extension)) {
      return iconBook;
    } else if (this.isDatabase()) {
      return iconDatabase;
    } else if (this.isCodeExtension()) {
      return iconCode;
    }
    return iconText;
  }

  isCodeExtension() {
    return fileTypes.source.includes(this.fileType);
  }

  isDatabase() {
{'fraction_non_alphanumeric': 0.13399249914763042, 'fraction_numerical': 0.0006818956699624957, 'mean_word_length': 3.577223088923557, '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': '3159363', 'n_tokens_mistral': 938, 'n_tokens_neox': 933, 'n_words': 206}