Skip to content

Instantly share code, notes, and snippets.

@isnifer
Last active February 7, 2018 11:16
Show Gist options
  • Save isnifer/42a1eb745b2ce10f7c83bfb44dab0423 to your computer and use it in GitHub Desktop.
Save isnifer/42a1eb745b2ce10f7c83bfb44dab0423 to your computer and use it in GitHub Desktop.
import { filter, union, keys } from 'lodash'
function changedKeys(o1, o2) {
return filter(union(keys(o1), keys(o2)), key => o1[key] !== o2[key]).map(key => ({
[key]: {
prev: o1[key],
next: o2[key],
},
}))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment