polystore 0.15.4 → 0.15.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "polystore",
3
- "version": "0.15.4",
3
+ "version": "0.15.5",
4
4
  "description": "A small compatibility layer for many popular KV stores like localStorage, Redis, FileSystem, etc.",
5
5
  "homepage": "https://polystore.dev/",
6
6
  "repository": "https://github.com/franciscop/polystore.git",
@@ -32,13 +32,13 @@ export default class File {
32
32
  // Internal
33
33
  #read = async () => {
34
34
  const fsp = await this.promise;
35
- const data = await fsp.readFile(this.file, "utf8");
36
- return JSON.parse(data || "{}");
35
+ const text = await fsp.readFile(this.file, "utf8");
36
+ return text ? JSON.parse(text) : {};
37
37
  };
38
38
 
39
39
  #write = async (data) => {
40
40
  const fsp = await this.promise;
41
- fsp.writeFile(this.file, JSON.stringify(data, null, 2));
41
+ return fsp.writeFile(this.file, JSON.stringify(data, null, 2));
42
42
  };
43
43
 
44
44
  get = async (key) => {