Fix minor bugs
authorNick Downing <nick@ndcode.org>
Fri, 7 Jan 2022 06:20:33 +0000 (17:20 +1100)
committerNick Downing <nick@ndcode.org>
Fri, 7 Jan 2022 06:20:33 +0000 (17:20 +1100)
LazyArray.mjs
LazyObject.mjs
Transaction.mjs

index e15d1d6..988b98a 100644 (file)
@@ -18,12 +18,12 @@ class LazyArray extends LazyValue {
     if (key < 0 || key >= this.length) {
       if (default_value === undefined)
         return undefined
-      set(key, default_value)
+      this.set(key, default_value)
     }
 
     let value = this.array[key]
     if (value instanceof Array) {
-      value = this.transaction.read(value)
+      value = await this.transaction.read(value)
       this.array[key] = value
     }
     return value
index 8923df9..136a8bb 100644 (file)
@@ -17,12 +17,12 @@ class LazyObject extends LazyValue {
     if (!Object.prototype.hasOwnProperty.call(this.object, key)) {
       if (default_value === undefined)
         return undefined
-      set(key, default_value)
+      this.set(key, default_value)
     }
 
     let value = this.object[key]
     if (value instanceof Array) {
-      value = this.transaction.read(value)
+      value = await this.transaction.read(value)
       this.object[key] = value
     }
     return value
index 8b91f78..91a6b82 100644 (file)
@@ -27,11 +27,11 @@ class Transaction {
     if (this.value === undefined) {
       if (default_value === undefined)
         return undefined
-      set(default_value)
+      this.set(default_value)
     }
 
     if (this.value instanceof Array)
-      this.value = this.read(this.value)
+      this.value = await this.read(this.value)
     return this.value
   }