Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ert78gb/js-crud-diff
Simple object diff tool
https://github.com/ert78gb/js-crud-diff
Last synced: about 1 month ago
JSON representation
Simple object diff tool
- Host: GitHub
- URL: https://github.com/ert78gb/js-crud-diff
- Owner: ert78gb
- Created: 2017-10-05T07:12:21.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2024-06-10T16:48:32.000Z (7 months ago)
- Last Synced: 2024-12-02T06:09:00.503Z (about 1 month ago)
- Language: JavaScript
- Size: 254 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
js-crud-diff
============Create a difference of the to object
```javascript
const before = {
a: {
b: {
c: '',
d: {
e: '',
g: ''
}
}
},
a2: {
b2: '',
c2: ''
}
}
const after = {
a: {
b: {
c: '',
d: {
e: ''
}
},
newProp: {
a: ''
}
},
a2: {
b2: 'asa'
}
}const difference = diff(before, after)
// value of the difference
// {
// a: {
// b: {
// d: {
// g: { // g deleted. original value was an empty string
// deleted: ''
// }
// }
// },
// newProp: { // newProp created with value {a: ''}
// created: {
// a: ''
// }
// }
// },
// a2: {
// b2: { // b2 modified
// after: 'asa', // new value
// before: '' // original value
// },
// c2: { // c2 deleted original value was an empty string
// deleted: ''
// }
// }
// }```