fixes empty file read

This commit is contained in:
Emmaline Autumn 2024-10-18 19:45:26 -06:00
parent fd7b218dc3
commit 091a1d3518
2 changed files with 2 additions and 2 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "@bearmetal/store", "name": "@bearmetal/store",
"version": "0.0.2", "version": "0.0.3",
"description": "A simple store for storing data in a JSON file.", "description": "A simple store for storing data in a JSON file.",
"files": [ "files": [
"mod.ts", "mod.ts",

View File

@ -77,7 +77,7 @@ export class BearMetalStore {
} }
private readIn() { private readIn() {
this.store = JSON.parse(Deno.readTextFileSync(this.storePath)); this.store = JSON.parse(Deno.readTextFileSync(this.storePath) || "{}");
} }
private writeOut() { private writeOut() {