trac-peer 0.0.14 → 0.0.16

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,7 +1,7 @@
1
1
  {
2
2
  "name": "trac-peer",
3
3
  "main": "src/index.js",
4
- "version": "0.0.14",
4
+ "version": "0.0.16",
5
5
  "type": "module",
6
6
  "dependencies": {
7
7
  "autobase": "7.0.45",
package/src/contract.js CHANGED
@@ -12,7 +12,9 @@ class Contract {
12
12
 
13
13
  async get(key){
14
14
  if(typeof this.storage === "undefined" || this.storage === null) throw new Error('get(key): storage undefined');
15
- return await this.storage.get(key);
15
+ const result = await this.storage.get(key);
16
+ if(null === result) return null;
17
+ return result.value;
16
18
  }
17
19
 
18
20
  async put(key, value){
package/src/protocol.js CHANGED
@@ -75,7 +75,9 @@ class Protocol{
75
75
  }
76
76
 
77
77
  async get(key){
78
- return await this.peer.base.view.get(key);
78
+ const result = await this.peer.base.view.get(key);
79
+ if(null === result) return null;
80
+ return result.value;
79
81
  }
80
82
  }
81
83