Add comments to truncate functions

This commit is contained in:
Wolfgang Huß 2021-03-29 13:03:59 +02:00
parent 6f79bba69d
commit b266e81727

View File

@ -24,6 +24,7 @@ export default ({ app = {} }) => {
}
return accounting.formatNumber(value || 0, precision, thousands, decimals)
},
// doesn't truncate in the middle of words
truncate: (value = '', length = -1) => {
if (!value || typeof value !== 'string' || value.length <= 0) {
return ''
@ -33,6 +34,7 @@ export default ({ app = {} }) => {
}
return trunc(value, length).html
},
// truncates in the middle of words
truncateStr: (value = '', length = -1) => {
if (!value || typeof value !== 'string' || value.length <= 0) {
return ''