mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
Add comments to truncate functions
This commit is contained in:
parent
6f79bba69d
commit
b266e81727
@ -24,6 +24,7 @@ export default ({ app = {} }) => {
|
|||||||
}
|
}
|
||||||
return accounting.formatNumber(value || 0, precision, thousands, decimals)
|
return accounting.formatNumber(value || 0, precision, thousands, decimals)
|
||||||
},
|
},
|
||||||
|
// doesn't truncate in the middle of words
|
||||||
truncate: (value = '', length = -1) => {
|
truncate: (value = '', length = -1) => {
|
||||||
if (!value || typeof value !== 'string' || value.length <= 0) {
|
if (!value || typeof value !== 'string' || value.length <= 0) {
|
||||||
return ''
|
return ''
|
||||||
@ -33,6 +34,7 @@ export default ({ app = {} }) => {
|
|||||||
}
|
}
|
||||||
return trunc(value, length).html
|
return trunc(value, length).html
|
||||||
},
|
},
|
||||||
|
// truncates in the middle of words
|
||||||
truncateStr: (value = '', length = -1) => {
|
truncateStr: (value = '', length = -1) => {
|
||||||
if (!value || typeof value !== 'string' || value.length <= 0) {
|
if (!value || typeof value !== 'string' || value.length <= 0) {
|
||||||
return ''
|
return ''
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user