Deep compare array fields
This commit is contained in:
parent
adb620fc77
commit
c3b5c51da7
@ -2,6 +2,7 @@
|
|||||||
* Building data access
|
* Building data access
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
import * as _ from 'lodash';
|
||||||
import { ITask } from 'pg-promise';
|
import { ITask } from 'pg-promise';
|
||||||
|
|
||||||
import db from '../../db';
|
import db from '../../db';
|
||||||
@ -423,7 +424,7 @@ function compare(oldObj: object, newObj: object): [object, object] {
|
|||||||
const reverse = {};
|
const reverse = {};
|
||||||
const forward = {};
|
const forward = {};
|
||||||
for (const [key, value] of Object.entries(newObj)) {
|
for (const [key, value] of Object.entries(newObj)) {
|
||||||
if (oldObj[key] != value) {
|
if (!_.isEqual(oldObj[key], value)) {
|
||||||
reverse[key] = oldObj[key];
|
reverse[key] = oldObj[key];
|
||||||
forward[key] = value;
|
forward[key] = value;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user