refactor: fix typo (unsave -> unsafe)
This commit is contained in:
parent
3b11054083
commit
9f411cf6c8
|
@ -24,15 +24,15 @@ const folder = path.dirname(options.path);
|
||||||
|
|
||||||
function initDir(): Promise<void> {
|
function initDir(): Promise<void> {
|
||||||
if (!fs.existsSync(folder)) {
|
if (!fs.existsSync(folder)) {
|
||||||
return fs.promises.mkdir(folder, { recursive: true }).then(() => writeUnsave());
|
return fs.promises.mkdir(folder, { recursive: true }).then(() => writeUnsafe());
|
||||||
}
|
}
|
||||||
if (!fs.existsSync(options.path)) {
|
if (!fs.existsSync(options.path)) {
|
||||||
return writeUnsave();
|
return writeUnsafe();
|
||||||
}
|
}
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
|
|
||||||
function writeUnsave(): Promise<void> {
|
function writeUnsafe(): Promise<void> {
|
||||||
return fs.writeFile(options.path, JSON.stringify(store));
|
return fs.writeFile(options.path, JSON.stringify(store));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ function read(): Promise<void> {
|
||||||
|
|
||||||
function write(): Promise<void> {
|
function write(): Promise<void> {
|
||||||
return initDir().then(() =>
|
return initDir().then(() =>
|
||||||
writeUnsave().then(() => {
|
writeUnsafe().then(() => {
|
||||||
synced = false;
|
synced = false;
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue