Re: [w3c/IndexedDB] Add getAllRecords() method and update getAll()/getAllKeys() to support direction option (PR #461)

@stelar7 commented on this pull request.



> +1. Switching on |direction|:
+
+    <dl class=switch>
+      : "next"
+      ::
+          1. Set |records| to the first |count| of |index|'s [=index/list of records=] whose [=index/key=] is [=in=] |range|.
+
+      : "nextunique"
+      ::
+          1. Let |range records| be a list containing the |index|'s [=index/list of records=] whose [=index/key=] is [=in=] |range|.
+          1. Let |range records length| be |range records|'s [=list/size=].
+          1. Let |i| be 0.
+          1. While |i| is less than |range records length|, then:
+              1. Increase |i| by 1.
+              1. if |record|'s [=list/size=] is equal to |count|, then [=iteration/break=].
+              1. If |i| is greater than 0 and the result of [=comparing two keys=] using the keys from |range records[i]| and |range records[i-1]| is equal, then [=iteration/continue=].

`i` is always `greater than 0` here, so this condition seems redundant

> +              1. If |i| is greater than 0 and the result of [=comparing two keys=] using the keys from |range records[i]| and |range records[i-1]| is equal, then [=iteration/continue=].
+              1. Else [=list/append=] |range records[i]| to |records|.
+
+      : "prev"
+      ::
+          1. Set |records| to the last |count| of |index|'s [=index/list of records=] whose [=index/key=] is [=in=] |range|.
+
+      : "prevunique"
+      ::
+          1. Let |range records| be a list containing the |index|'s [=index/list of records=] whose [=index/key=] is [=in=] |range|.
+          1. Let |range records length| be |range records|'s [=list/size=].
+          1. Let |i| be 0.
+          1. While |i| is less than |range records length|, then:
+              1. Increase |i| by 1.
+              1. if |record|'s [=list/size=] is equal to |count|, then [=iteration/break=].
+              1. If |i| is greater than 0 and the result of [=comparing two keys=] using the keys from |range records[i]| and |range records[i-1]| is equal, then [=iteration/continue=].

`i` is always `greater than 0` here, so this condition seems redundant

-- 
Reply to this email directly or view it on GitHub:
https://github.com/w3c/IndexedDB/pull/461#pullrequestreview-3004262462
You are receiving this because you are subscribed to this thread.

Message ID: <w3c/IndexedDB/pull/461/review/3004262462@github.com>

Received on Thursday, 10 July 2025 07:07:15 UTC