From 65371c75a9a6462451a157bc221355365a05bd4e Mon Sep 17 00:00:00 2001 From: Dan Coffey Date: Wed, 10 Feb 2021 13:22:08 -0500 Subject: [PATCH 1/2] added check for non-existent file path --- src/lib/decorateObject.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lib/decorateObject.ts b/src/lib/decorateObject.ts index 00f019d..80697f0 100644 --- a/src/lib/decorateObject.ts +++ b/src/lib/decorateObject.ts @@ -14,7 +14,9 @@ export const decorateObject = (target: T, implementation: LogF if (config.saveToFile !== null) { const dirPath = path.parse(config.saveToFile).dir; - fs.mkdirSync(dirPath, { recursive: true }); + if (dirPath !== "") { + fs.mkdirSync(dirPath, { recursive: true }); + } } const funcFactory = (type: LogType): LogFunction => (msg: string, ...args: unknown[]) => { From b8b4fd85f874fae97e9adf64a9904cd20019a94c Mon Sep 17 00:00:00 2001 From: Dan Coffey Date: Wed, 10 Feb 2021 22:25:52 -0500 Subject: [PATCH 2/2] double to single quotes --- src/lib/decorateObject.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/decorateObject.ts b/src/lib/decorateObject.ts index 80697f0..546e38b 100644 --- a/src/lib/decorateObject.ts +++ b/src/lib/decorateObject.ts @@ -14,7 +14,7 @@ export const decorateObject = (target: T, implementation: LogF if (config.saveToFile !== null) { const dirPath = path.parse(config.saveToFile).dir; - if (dirPath !== "") { + if (dirPath !== '') { fs.mkdirSync(dirPath, { recursive: true }); } }