2019-08-08 09:10:54 -04:00
|
|
|
_ = require('lodash')
|
|
|
|
|
2019-07-31 10:25:54 -04:00
|
|
|
showLength = (thing) ->
|
2019-08-08 09:10:54 -04:00
|
|
|
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
|
2018-03-07 11:16:19 -05:00
|
|
|
|
2019-07-31 10:25:54 -04:00
|
|
|
module.exports =
|
|
|
|
# replace long values with their length
|
|
|
|
lines: showLength
|
|
|
|
oldLines: showLength
|
|
|
|
newLines: showLength
|
2019-08-08 09:10:54 -04:00
|
|
|
docLines: showLength
|
|
|
|
newDocLines: showLength
|
2019-07-31 10:25:54 -04:00
|
|
|
ranges: showLength
|
2019-08-08 09:10:54 -04:00
|
|
|
update: showUpdateLength
|