| Total Complexity | 1 | 
| Complexity/F | 0 | 
| Lines of Code | 27 | 
| Function Count | 0 | 
| Duplicated Lines | 0 | 
| Ratio | 0 % | 
| Changes | 0 | ||
| 1 | import { useRef, useMemo } from "react"; | 
            ||
| 2 | |||
| 3 | const compareInputs = (inputKeys, oldInputs, newInputs) => { | 
            ||
| 4 |   inputKeys.forEach(key => { | 
            ||
| 5 | const oldInput = oldInputs[key];  | 
            ||
| 6 | const newInput = newInputs[key];  | 
            ||
| 7 |     if (oldInput !== newInput) { | 
            ||
| 8 |       console.log("change detected", key, "old:", oldInput, "new:", newInput); | 
            ||
| 9 | }  | 
            ||
| 10 | });  | 
            ||
| 11 | };  | 
            ||
| 12 | |||
| 13 | const useDependenciesDebugger = inputs => { | 
            ||
| 14 | const oldInputsRef = useRef(inputs);  | 
            ||
| 15 | const inputValuesArray = Object.values(inputs);  | 
            ||
| 16 | const inputKeysArray = Object.keys(inputs);  | 
            ||
| 17 |   useMemo(() => { | 
            ||
| 18 | const oldInputs = oldInputsRef.current;  | 
            ||
| 19 | |||
| 20 | compareInputs(inputKeysArray, oldInputs, inputs);  | 
            ||
| 21 | |||
| 22 | oldInputsRef.current = inputs;  | 
            ||
| 23 | }, inputValuesArray); // eslint-disable-line react-hooks/exhaustive-deps  | 
            ||
| 24 | };  | 
            ||
| 25 | |||
| 26 | export default useDependenciesDebugger;  | 
            ||
| 27 |