Jump to conversation
Unresolved conversations (1)
@alexandrebodin alexandrebodin Sep 2, 2020
Do you really need the JSON.parse of JSON.stringify here ?
Outdated
...n-documentation/services/Documentation.js
gh0stsh0t
RJ Perias
Resolved conversations (1)
@alexandrebodin alexandrebodin Jan 8, 2021
Hi starting from your code I made a simplified version that doesn't require a sort but runs a recursive compare instead. Can you refactor to match this logic ? ```js const cleanObject = obj => JSON.parse(JSON.stringify(obj)); const customComparator = (value1, value2) => { if (_.isArray(value1) && _.isArray(value2)) { if (value1.length !== value2.length) { return false }; return value1.every(el1 => value2.findIndex(el2 => customIsEqual(el1, el2)) >= 0) } } const customIsEqual = (obj1, obj2) => _.isEqualWith(obj1, obj2, customComparator) const areObjectsEquals = (obj1, obj2) => { return customIsEqual(cleanObject(obj1), cleanObject(obj2)) } ```
...n-documentation/services/Documentation.js
gh0stsh0t
RJ Perias