import type { ComparisonRow } from '@tool.io/tools/compare';
export type ComparisonRowMode = 'all' | 'different' | 'shared';
export const filterComparisonRows = (
rows: readonly ComparisonRow[],
mode: ComparisonRowMode
): readonly ComparisonRow[] => {
if (mode === 'different') {
return rows.filter((row) => row.hasDifference);
}
if (mode === 'shared') {
return rows.filter((row) =>
row.cells.every((cell) => cell.missingReason === null)
);
}
return rows;
};
Browse the implementation files for RAM Comparison.