LoggerSerializers.coffee 648 B

12345678910111213141516171819202122232425
  1. _ = require('lodash')
  2. showLength = (thing) ->
  3. if thing?.length then thing.length else thing
  4. showUpdateLength = (update) ->
  5. if update?.op instanceof Array
  6. copy = _.cloneDeep(update)
  7. copy.op.forEach (element, index) ->
  8. copy.op[index].i = element.i.length if element?.i?.length?
  9. copy.op[index].d = element.d.length if element?.d?.length?
  10. copy.op[index].c = element.c.length if element?.c?.length?
  11. copy
  12. else
  13. update
  14. module.exports =
  15. # replace long values with their length
  16. lines: showLength
  17. oldLines: showLength
  18. newLines: showLength
  19. docLines: showLength
  20. newDocLines: showLength
  21. ranges: showLength
  22. update: showUpdateLength