CEC-2587 Add edge_mask field (#217)
This commit is contained in:
13
src/utils/strings.js
Normal file
13
src/utils/strings.js
Normal file
@@ -0,0 +1,13 @@
|
||||
export function trimIfMoreThan(maybeString, maxLength = 20, sfx = "") {
|
||||
if (typeof maybeString == "string" && maybeString !== "") {
|
||||
let toAppSfx = sfx
|
||||
let toTrimLnth = maxLength - toAppSfx.length
|
||||
if (maybeString.length <= maxLength) {
|
||||
toAppSfx = ""
|
||||
toTrimLnth = maxLength
|
||||
}
|
||||
return maybeString.substring(0, toTrimLnth) + toAppSfx
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
Reference in New Issue
Block a user