Metakit / @doeixd/metakit/graph/match

minimizePaths

function · packages/metakit/src/graph/match.ts:22

function minimizePaths(
  paths: ReadonlyArray<ReadonlyArray<string>>,
): ReadonlyArray<ReadonlyArray<string>>

Deduplicate and minimize a list of paths: ['account'] subsumes ['account', 'balance'], and ['todos', '*'] subsumes ['todos', '0', 'title']. A concrete segment does not subsume a wildcard (['todos', '0'] leaves ['todos', '*', 'title'] standing), since it covers that path for one index only. Deterministic order.