Fix dirname error
This commit is contained in:
parent
0d1a44eb55
commit
00f21b7d83
1 changed files with 3 additions and 1 deletions
|
@ -3,7 +3,7 @@ import * as fs from 'fs';
|
||||||
|
|
||||||
const writeDB = promisify(fs.writeFile);
|
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 {
|
class MitDB {
|
||||||
/**
|
/**
|
||||||
|
@ -14,6 +14,8 @@ class MitDB {
|
||||||
* @param options.dirname where to put the database?
|
* @param options.dirname where to put the database?
|
||||||
*/
|
*/
|
||||||
constructor(fn?: string, options?: { dirname: string }) {
|
constructor(fn?: string, options?: { dirname: string }) {
|
||||||
|
if (!dirname || dirname != 'data') dirname = 'data';
|
||||||
|
|
||||||
map = new Map();
|
map = new Map();
|
||||||
|
|
||||||
if (fn) filename = fn;
|
if (fn) filename = fn;
|
||||||
|
|
Loading…
Reference in a new issue