In-game tools · function

componentDivergence

Which components two peers hash differently, in the order they are first seen.

Explained in In-game tools.

function componentDivergence(ours: ReadonlyMap<string, string>, theirs: ReadonlyMap<string, string>): string[]
import { componentDivergence } from '@driftengine/tools';

Parameters

ParameterTypeDescription
oursReadonlyMap<string, string>
theirsReadonlyMap<string, string>

In depth

The comparison itself lives in pie/divergence.ts, which is where the divergence search needs it too. Two copies of "which of these hashes disagree" is two places for the rule about a component only one side has to be got wrong, and a panel is the wrong owner of a rule — it uses one. This keeps its own shape, returning a fresh array, because a panel builds a line of text from it once per rebuild and an out-parameter would be ceremony for nothing.