<commit_before>import path from 'path';
import fs from 'fs';

const getViewBoxDimensions = dir => file => {
  const fileContent = fs.readFileSync(path.join(dir, file), 'utf-8');
  const matches = fileContent.match(/viewBox=\"0 0 (\d+(?:\.\d+)?) (\d+(?:\.\d+)?)\"/);
  if ( ! matches) return;
  return {
    width: parseFloat(matches[1]),
    heigth: parseFloat(matches[2])
  }
};

const walkSync = function(dir) {
  const isDirectory = dir => file => fs.statSync(path.join(dir, file)).isDirectory();
  const filter = dir => file => file.match(/\.svg$/) || isDirectory(dir)(file);
  return fs.readdirSync(dir).filter(filter(dir)).map(function(file) {
    if (isDirectory(dir)(file)) {
      return {
        isFile: false,
        id: file,
        colors: walkSync(path.join(dir, file))
      };
    } else {
      return {
        isFile: true,
        id: file,
        style: getViewBoxDimensions(dir)(file)
      };
    }
  });
};

export const getFiles = () => {
  return walkSync('public/svg/');
};<commit_msg>Fix typo for height<commit_after>import path from 'path';
import fs from 'fs';

const getViewBoxDimensions = dir => file => {
  const fileContent = fs.readFileSync(path.join(dir, file), 'utf-8');
  const matches = fileContent.match(/viewBox=\"0 0 (\d+(?:\.\d+)?) (\d+(?:\.\d+)?)\"/);
  if ( ! matches) return;
  return {
    width: parseFloat(matches[1]),
    height: parseFloat(matches[2])
  }
};

const walkSync = function(dir) {
  const isDirectory = dir => file => fs.statSync(path.join(dir, file)).isDirectory();
  const filter = dir => file => file.match(/\.svg$/) || isDirectory(dir)(file);
  return fs.readdirSync(dir).filter(filter(dir)).map(function(file) {
    if (isDirectory(dir)(file)) {
      return {
        isFile: false,
        id: file,
        colors: walkSync(path.join(dir, file))
      };
    } else {
      return {
        isFile: true,
        id: file,
        style: getViewBoxDimensions(dir)(file)
      };
    }
  });
};

export const getFiles = () => {
  return walkSync('public/svg/');
};
{'fraction_non_alphanumeric': 0.1903827281648675, 'fraction_numerical': 0.004906771344455349, 'mean_word_length': 3.0296442687747036, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, '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': '725241', 'n_tokens_mistral': 693, 'n_tokens_neox': 688, 'n_words': 145}