CEC-2587 Add edge_mask field (#217)

This commit is contained in:
arpanetus
2022-10-14 19:35:58 +06:00
committed by GitHub
parent 3d06baa272
commit 131c97fa7b
8 changed files with 158 additions and 0 deletions

13
src/utils/strings.js Normal file
View 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 ""
}