This commit is contained in:
D065023
2020-01-08 13:49:59 +01:00
parent dc1ea91d9e
commit 920600a5ff
2 changed files with 13 additions and 16 deletions

View File

@@ -4,12 +4,15 @@ process.env['https_proxy'] = ''
process.env['HTTP_PROXY'] = ''
process.env['HTTPS_PROXY'] = ''
const diff = (obj1, obj2) => Object.keys(obj1).reduce((res, curr) => (obj1[curr] === obj2[curr] ? res : (res[curr] = obj2[curr]) && res), {})
const diff = (obj1, obj2) =>
Object.keys(obj1).reduce((res, curr) => (obj1[curr] === obj2[curr] ? res : (res[curr] = obj2[curr]) && res), {})
const queriesToUpdateDifferences = (entity, ownEntries, otherEntries) =>
ownEntries
.map(ownEntry => {
const otherEntry = otherEntries.find(otherEntry => Object.keys(entity.keys).reduce((res, curr) => res && otherEntry[curr] === ownEntry[curr], true))
const otherEntry = otherEntries.find(otherEntry =>
Object.keys(entity.keys).reduce((res, curr) => res && otherEntry[curr] === ownEntry[curr], true)
)
if (otherEntry) {
const differences = diff(ownEntry, otherEntry)
if (Object.keys(differences).length) {