Skip to content

Commit

Permalink
chore: remove floating vars
Browse files Browse the repository at this point in the history
  • Loading branch information
danielo515 committed Nov 3, 2023
1 parent 0d5afbd commit a89d1a2
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/utils/files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,9 @@ export class NotAFileError extends Error {
type FolderError = FolderDoesNotExistError | NotAFolderError;

export function resolve_tfolder(folder_str: string, app: App): Either<FolderError, TFolder> {
folder_str = normalizePath(folder_str);

return pipe(
app.vault.getAbstractFileByPath(folder_str),
normalizePath(folder_str),
(path) => app.vault.getAbstractFileByPath(path),
E.fromNullable(new FolderDoesNotExistError(`Folder "${folder_str}" doesn't exist`)),
E.flatMap((file) => {
if (!(file instanceof TFolder)) {
Expand All @@ -44,7 +43,7 @@ export function resolve_tfolder(folder_str: string, app: App): Either<FolderErro
export function resolve_tfile(file_str: string, app: App): Either<FileDoesNotExistError | NotAFileError, TFile> {
return pipe(
normalizePath(file_str),
app.vault.getAbstractFileByPath,
(path) => app.vault.getAbstractFileByPath(path),
E.fromNullable(FileDoesNotExistError.of(file_str)),
E.flatMap((file) => {
if (!(file instanceof TFile)) {
Expand Down

0 comments on commit a89d1a2

Please sign in to comment.