From 091a1d3518b0171d1ed671c4a420b7c00a91e676 Mon Sep 17 00:00:00 2001 From: Emma Date: Fri, 18 Oct 2024 19:45:26 -0600 Subject: [PATCH] fixes empty file read --- deno.json | 2 +- store.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/deno.json b/deno.json index 072f1a1..dfafdef 100644 --- a/deno.json +++ b/deno.json @@ -1,6 +1,6 @@ { "name": "@bearmetal/store", - "version": "0.0.2", + "version": "0.0.3", "description": "A simple store for storing data in a JSON file.", "files": [ "mod.ts", diff --git a/store.ts b/store.ts index bf4e3a7..6754310 100644 --- a/store.ts +++ b/store.ts @@ -77,7 +77,7 @@ export class BearMetalStore { } private readIn() { - this.store = JSON.parse(Deno.readTextFileSync(this.storePath)); + this.store = JSON.parse(Deno.readTextFileSync(this.storePath) || "{}"); } private writeOut() {