WIPP
This commit is contained in:
parent
30071151ff
commit
15678530fd
3 changed files with 12 additions and 3 deletions
|
|
@ -30,11 +30,22 @@ function post (tx, pi) {
|
|||
})
|
||||
}
|
||||
|
||||
function nilEqual (a, b) {
|
||||
if (_.isNil(a) && _.isNil(b)) return true
|
||||
|
||||
return undefined
|
||||
}
|
||||
|
||||
function diff (oldTx, newTx) {
|
||||
let updatedTx = {}
|
||||
|
||||
UPDATEABLE_FIELDS.forEach(fieldKey => {
|
||||
if (oldTx && _.isEqual(oldTx[fieldKey], newTx[fieldKey])) return
|
||||
console.log('DEBUG80: %j', [oldTx[fieldKey], newTx[fieldKey]])
|
||||
if (oldTx && _.isEqualWith(nilEqual, oldTx[fieldKey], newTx[fieldKey])) return
|
||||
|
||||
// We never null out an existing field
|
||||
if (oldTx && _.isNil(newTx[fieldKey])) return
|
||||
|
||||
updatedTx[fieldKey] = newTx[fieldKey]
|
||||
})
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue