refactor: fix typo (unsave -> unsafe)

This commit is contained in:
Xymorot 2020-04-10 15:54:38 +02:00
parent 3b11054083
commit 9f411cf6c8
1 changed files with 4 additions and 4 deletions

View File

@ -24,15 +24,15 @@ const folder = path.dirname(options.path);
function initDir(): Promise<void> {
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)) {
return writeUnsave();
return writeUnsafe();
}
return Promise.resolve();
}
function writeUnsave(): Promise<void> {
function writeUnsafe(): Promise<void> {
return fs.writeFile(options.path, JSON.stringify(store));
}
@ -47,7 +47,7 @@ function read(): Promise<void> {
function write(): Promise<void> {
return initDir().then(() =>
writeUnsave().then(() => {
writeUnsafe().then(() => {
synced = false;
})
);