import { type Deno } from "https://deno.land/x/deno@v2.0.4/cli/tsc/dts/lib.deno.unstable.d.ts";
const { KvKeyPart } = Deno;
UNSTABLE: New API, yet to be vetted.
A single part of a Deno.KvKey
. Parts are ordered
lexicographically, first by their type, and within a given type by their
value.
The ordering of types is as follows:
Uint8Array
string
number
bigint
boolean
Within a given type, the ordering is as follows:
Uint8Array
is ordered by the byte ordering of the arraystring
is ordered by the byte ordering of the UTF-8 encoding of the stringnumber
is ordered following this pattern:-NaN
<-Infinity
<-100.0
<-1.0
< -0.5
<-0.0
<0.0
<0.5
<1.0
<100.0
<Infinity
<NaN
bigint
is ordered by mathematical ordering, with the largest negative number being the least first value, and the largest positive number being the last valueboolean
is ordered byfalse
<true
This means that the part 1.0
(a number) is ordered before the part 2.0
(also a number), but is greater than the part 0n
(a bigint), because
1.0
is a number and 0n
is a bigint, and type ordering has precedence
over the ordering of values within a type.