overleaf/services/track-changes/app/js/util/PackUtils.js
Miguel Serrano bb04841504 [track-changes] Ignore duplicated packs when zipping SL history (#8353)
* [track-changes] Ignore duplicated packs when zipping SL history

* Fix incorrect `ObjectId` import in unit tests

GitOrigin-RevId: 165fcaa0c7bc57d383d01eedaf6dd3b078aff2aa
2022-06-13 08:03:22 +00:00

18 lines
336 B
JavaScript

const _ = require('lodash')
/**
* Compares a deep equality of Packs excluding _id
*/
function packsAreDuplicated(pack1, pack2) {
return Boolean(
pack1 &&
pack2 &&
pack1.v === pack2.v &&
_.isEqual(pack1.meta, pack2.meta) &&
_.isEqual(pack1.op, pack2.op)
)
}
module.exports = {
packsAreDuplicated,
}