Skip to content

armgit / mimik

Public Imported from GitHub
0

🎬 A browser extension and desktop app that turns your clicks into step-by-step guides with annotated screenshots πŸ“–

470 B
Raw Blame
export type SettingsSnapshot = Record<string, unknown>;

export function changedSettings(next: SettingsSnapshot, previous: SettingsSnapshot): SettingsSnapshot | null {
  const patch: SettingsSnapshot = {};
  for (const [key, value] of Object.entries(next)) {
    if (Object.is(value, previous[key])) continue;
    if (JSON.stringify(value) === JSON.stringify(previous[key])) continue;
    patch[key] = value;
  }
  return Object.keys(patch).length > 0 ? patch : null;
}