Skip to content

compare

compare(a, b): number

Defined in: src/uuid/codec.ts:172

Byte-order comparison, which is also chronological order for the time-ordered versions 6 and 7.

Returns a number suitable for Array.prototype.sort.

string

string

number

[v7(), v7(), v7()].sort(compare); // oldest first
compare(NIL, MAX); // -1
compare(NIL, NIL); // 0