Skip to content

Instantly share code, notes, and snippets.

@Akiyamka
Created June 12, 2020 14:28
Show Gist options
  • Save Akiyamka/c32e5877277cf477f0af73a99b5ab9ee to your computer and use it in GitHub Desktop.
Save Akiyamka/c32e5877277cf477f0af73a99b5ab9ee to your computer and use it in GitHub Desktop.
function debugLogChanges() {
let lastDeps = [];
return deps => {
deps.forEach((d, i) => {
if (!Object.is(lastDeps[i], d)) {
console.log(`Change in [${i}]:`, lastDeps[i], '->', d);
}
});
lastDeps = deps;
return deps;
};
}
const logger = debugLogChanges();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment