1
0
Fork 0
mirror of https://github.com/overleaf/overleaf.git synced 2025-04-22 20:07:40 +00:00

Improve/fix serializers for update logging ()

* Improve/fix serializers for update logging
This commit is contained in:
Simon Detheridge 2019-08-08 14:10:54 +01:00 committed by GitHub
parent ad485709cf
commit 06444d2cc4

View file

@ -1,10 +1,25 @@
_ = require('lodash')
showLength = (thing) ->
"length: #{thing?.length}"
if thing?.length then thing.length else thing
showUpdateLength = (update) ->
if update?.op instanceof Array
copy = _.cloneDeep(update)
copy.op.forEach (element, index) ->
copy.op[index].i = element.i.length if element?.i?.length?
copy.op[index].d = element.d.length if element?.d?.length?
copy.op[index].c = element.c.length if element?.c?.length?
copy
else
update
module.exports =
# replace long values with their length
lines: showLength
oldLines: showLength
newLines: showLength
docLines: showLength
newDocLines: showLength
ranges: showLength
update: showLength
update: showUpdateLength