From 82742705d84478bf84c20500b53d82e79ca24efc Mon Sep 17 00:00:00 2001 From: anpigon Date: Mon, 15 Aug 2022 13:32:18 +0900 Subject: [PATCH] refactor: makeFileName --- src/utils/utils.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/utils/utils.ts b/src/utils/utils.ts index 3f9b46b..3b169e8 100644 --- a/src/utils/utils.ts +++ b/src/utils/utils.ts @@ -15,14 +15,14 @@ export function isISBN(str: string) { } export function makeFileName(book: Book, fileNameFormat: string) { + if (fileNameFormat) { + return replaceVariableSyntax(book, replaceDateInString(fileNameFormat)); + } const titleForFileName = replaceIllegalFileNameCharactersInString(book.title); if (!book.author) { return titleForFileName; } const authorForFileName = replaceIllegalFileNameCharactersInString(book.author); - if (fileNameFormat) { - return replaceVariableSyntax(book, replaceDateInString(fileNameFormat)); - } return `${titleForFileName} - ${authorForFileName}`; }