export const getExtension = (filename: string) => {
  const extension = filename.split('.').pop();
  if (!extension) return '';
  return extension;
};
export const supportedExtensions = ['ts', 'js', 'md', 'json', 'yaml', 'yml', 'css', 'html'];

export function getFileType(filename: string) {
  const extension = getExtension(filename);
  if (!supportedExtensions.includes(extension)) return '';
  switch (extension) {
    case 'ts':
      return 'typescript';
    case 'js':
      return 'javascript';
    case 'md':
      return 'markdown';
    case 'json':
      return 'json';
    case 'yaml':
      return 'yaml';
    case 'yml':
      return 'yaml';
    case 'css':
      return 'css';
    case 'html':
      return 'html';
    default:
      return '';
  }
}
