cape-changes
v1.0.0
Published
Simple item list diff.
Downloads
1
Readme
Simple item list diff.
Say you have a saved
list of items and you fetch a fresh
list of items. Use this library to compare and get lists of created
, updated
, deleted
items.
API
createFeedInfo(items)
Returns { items: [{ id: 'abc', revision: 'f3295...'}], revision: 'aw3bc123' }
- Adds revision property on every item.
- Calculates revision of all items.
checkFeed(saved, fresh)
saved
needs to have items in the form of an object keyed by id.
getTouchedIds(checkFeedResult)
Creates a single array that combines created
, updated
, deleted
. That order may change in the future.
Each value in the array looks like { id: ID, action: ACTION }
.
checkFeedGetTouched(saved, fresh)
Same as checkFeed
but includes touchedIds
field.