Automerge backed Markdown editor for the Atmosphere
Something went wrong. Try again.
123456789101112131415161718/** Application-facing Automerge heads. Head order is not significant. */export type Heads = readonly string[]
/** Return a defensive, canonical copy for unordered-head comparisons. */export function normalizeHeads(heads: Heads): string[] { return [...heads].sort()}
export function headsEqual(a: Heads, b: Heads): boolean { const left = normalizeHeads(a) const right = normalizeHeads(b) return left.length === right.length && left.every((head, index) => head === right[index])}
export function headsKey(heads: Heads): string { return JSON.stringify(normalizeHeads(heads))}