added function to remove control characters from names

This commit is contained in:
2021-11-22 16:37:00 +01:00
parent 6f6834e7ea
commit e6d3a94105
4 changed files with 28 additions and 6 deletions

View File

@@ -70,7 +70,8 @@ export const constructAvatarUrl = (hash, size) => {
export const sortObjectValue = (obj, direction = 'asc') => {
const sortable = []
for (let key in obj) {
sortable.push([key, obj[key]])}
sortable.push([key, obj[key]])
}
if (direction === 'asc') {
sortable.sort((a, b) => {
@@ -101,3 +102,12 @@ export const scrollToPos = (pos = 0) => {
behavior: 'smooth'
})
}
export const StripControlCodes = (str = '') => {
const regexpControl = /\p{C}/gu;
return str.replace(regexpControl, '')
}
export const ProcessName = (str = '') => {
return StripControlCodes(str).trim()
}