API View source
compareDeterministically()
Deterministically compares two events when causal proof is insufficient.
Signature
function compareDeterministically<T>(
a: EventEnvelope<T>,
b: EventEnvelope<T>,
tieBreaker?: TieBreaker<T>,
): numberUse this when stronger causal proof is unavailable but you still need deterministic fallback ordering over event envelopes.
Usage
import { compareDeterministically } from "causal-order"
const result = compareDeterministically(eventA, eventB, "event_id")
console.log(result) Details
- Use this when stronger causal proof is unavailable but you still need stable fallback ordering.
- The return value is a comparator-style number suitable for deterministic ordering decisions.