Skip to content

Commit

Permalink
Merge pull request #50 from dcoffey3296/master
Browse files Browse the repository at this point in the history
added check for non-existent file path
  • Loading branch information
Olian04 authored Feb 12, 2021
2 parents d1a7c42 + b8b4fd8 commit 904b670
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/lib/decorateObject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ export const decorateObject = <T extends object>(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[]) => {
Expand Down

0 comments on commit 904b670

Please sign in to comment.