Something went wrong. Try again.
playing toys (CRDTs)
Something went wrong. Try again.
1234567891011121314151617import { Comparator } from "./ordered-set.ts";
export type PeerId = string;export type Tid = number;export type Timestamp = [PeerId, Tid];
// deno-lint-ignore no-explicit-anyexport const basicCompare: Comparator<any> = (a, b) => (a < b ? -1 : a > b ? 1 : 0);
export const timestampCompare: Comparator<Timestamp> = (a, b) => { const at = basicCompare(a[1], b[1]); if (at !== 0) return at; return basicCompare(a[0], b[0]);};
export type Primitive = string | number | boolean | undefined | null;