added function to remove control characters from names
This commit is contained in:
@@ -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()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user