Skip to content

Commit

Permalink
[chore]cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Inalegwu committed Jun 6, 2024
1 parent 05efffc commit de0535d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/shared/routers/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import { z } from "zod";
import { matchFileType } from "../utils";

function parseFilePath(path: string) {
const fileExt = path.match(/\.[^/.]+$/)?.[0].split(".")[1];
const matchedFileType = matchFileType(
path.match(/\.[^/.]+$/)?.[0].split(".")[1] || "",
);

const matchedFileType = matchFileType(fileExt || "");

console.log(fileExt);
console.log(matchedFileType);

return {
fileName: "",
Expand Down
8 changes: 4 additions & 4 deletions src/shared/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@ export const randomNumber = () =>
export const randomNumberfromInterval = (min: number, max: number) =>
Math.floor(Math.random() * (max - min + 1) + min);

export const matchFileType = (fileExt: string) => {
if (fileExt === FileTypes.MD) {
export const matchFileType = (ext: string) => {
if (ext === FileTypes.MD) {
return FileTypes.MD;
}

if (fileExt === FileTypes.DOCX) {
if (ext === FileTypes.DOCX) {
return FileTypes.DOCX;
}

if (fileExt === FileTypes.TXT) {
if (ext === FileTypes.TXT) {
return FileTypes.TXT;
}

Expand Down

0 comments on commit de0535d

Please sign in to comment.