2020-05-06 06:09:15 -04:00
|
|
|
/* eslint-disable
|
|
|
|
no-return-assign,
|
|
|
|
*/
|
|
|
|
// TODO: This file was created by bulk-decaffeinate.
|
|
|
|
// Fix any style issues and re-enable lint.
|
2020-05-06 06:08:21 -04:00
|
|
|
/*
|
|
|
|
* decaffeinate suggestions:
|
|
|
|
* DS102: Remove unnecessary code created because of implicit returns
|
|
|
|
* DS207: Consider shorter variations of null checks
|
|
|
|
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
|
|
|
|
*/
|
2020-05-06 06:09:33 -04:00
|
|
|
const _ = require('lodash')
|
2019-08-08 09:10:54 -04:00
|
|
|
|
2020-05-06 06:09:33 -04:00
|
|
|
const showLength = function (thing) {
|
|
|
|
if (thing != null ? thing.length : undefined) {
|
|
|
|
return thing.length
|
|
|
|
} else {
|
|
|
|
return thing
|
|
|
|
}
|
|
|
|
}
|
2019-08-08 09:10:54 -04:00
|
|
|
|
2020-05-06 06:09:33 -04:00
|
|
|
const showUpdateLength = function (update) {
|
|
|
|
if ((update != null ? update.op : undefined) instanceof Array) {
|
|
|
|
const copy = _.cloneDeep(update)
|
|
|
|
copy.op.forEach(function (element, index) {
|
2022-07-28 04:23:50 -04:00
|
|
|
if (element?.i?.length != null) {
|
2020-05-06 06:09:33 -04:00
|
|
|
copy.op[index].i = element.i.length
|
|
|
|
}
|
2022-07-28 04:23:50 -04:00
|
|
|
if (element?.d?.length != null) {
|
2020-05-06 06:09:33 -04:00
|
|
|
copy.op[index].d = element.d.length
|
|
|
|
}
|
2022-07-28 04:23:50 -04:00
|
|
|
if (element?.c?.length != null) {
|
2020-05-06 06:09:33 -04:00
|
|
|
return (copy.op[index].c = element.c.length)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
return copy
|
|
|
|
} else {
|
|
|
|
return update
|
|
|
|
}
|
|
|
|
}
|
2018-03-07 11:16:19 -05:00
|
|
|
|
2020-05-06 06:08:21 -04:00
|
|
|
module.exports = {
|
2020-05-06 06:09:33 -04:00
|
|
|
// replace long values with their length
|
|
|
|
lines: showLength,
|
|
|
|
oldLines: showLength,
|
|
|
|
newLines: showLength,
|
|
|
|
docLines: showLength,
|
|
|
|
newDocLines: showLength,
|
|
|
|
ranges: showLength,
|
2021-07-13 07:04:42 -04:00
|
|
|
update: showUpdateLength,
|
2020-05-06 06:09:33 -04:00
|
|
|
}
|