Cleanup - unused files / unused exports / duplicate exports
[ProtonMail-WebClient.git] / packages / shared / lib / debug / changedDeps.ts
blob76539a61145ac2230311d60851a17b689fa08c72
1 export const debugChangedDeps = <T extends any[]>(
2     dependencies: T,
3     previousDeps: T | undefined,
4     dependencyNames?: string[],
5     logPrefix = ''
6 ) => {
7     const changedDeps = dependencies.reduce((accum: object, dependency, index) => {
8         if (dependency !== previousDeps?.[index]) {
9             const keyName = dependencyNames?.[index] || index;
10             return {
11                 ...accum,
12                 [keyName]: {
13                     before: previousDeps?.[index],
14                     after: dependency,
15                 },
16             };
17         }
19         return accum;
20     }, {});
22     if (Object.keys(changedDeps).length) {
23         console.log(` [${logPrefix}-use-effect-debugger]`, changedDeps);
24     }