From 00f21b7d83477299b245f91d53cdad2a3e82bb37 Mon Sep 17 00:00:00 2001 From: Killer Boss Original <73131550+killerbossoriginal@users.noreply.github.com> Date: Thu, 23 Feb 2023 10:50:05 +0000 Subject: [PATCH] Fix dirname error --- src/index.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 6cb9b90..d8f9046 100644 --- a/src/index.ts +++ b/src/index.ts @@ -3,7 +3,7 @@ import * as fs from 'fs'; const writeDB = promisify(fs.writeFile); -let map: any, db: any, filename: string, dirname: string = 'data'; +let map: any, db: any, filename: string, dirname: string; class MitDB { /** @@ -14,6 +14,8 @@ class MitDB { * @param options.dirname where to put the database? */ constructor(fn?: string, options?: { dirname: string }) { + if (!dirname || dirname != 'data') dirname = 'data'; + map = new Map(); if (fn) filename = fn;