Unverified Commit 4714fb2c authored by Hong Minhee's avatar Hong Minhee
Browse files

Simplify prefix check in MemoryKvStore.list() using prefix.every()

parent ff435a02
Loading
Loading
Loading
Loading
+1 −8
Original line number Diff line number Diff line
@@ -186,14 +186,7 @@ export class MemoryKvStore implements KvStore {
      // Check prefix match
      if (prefix != null) {
        if (key.length < prefix.length) continue;
        let matches = true;
        for (let i = 0; i < prefix.length; i++) {
          if (key[i] !== prefix[i]) {
            matches = false;
            break;
          }
        }
        if (!matches) continue;
        if (!prefix.every((p, i) => key[i] === p)) continue;
      }

      const [value, expiration] = entry;