chore(server): Move api-server in to it's own DIR
This commit is contained in:
committed by
mrugesh mohapatra
parent
9fba6bce4c
commit
46a217d0a5
26
api-server/server/utils/index.js
Normal file
26
api-server/server/utils/index.js
Normal file
@ -0,0 +1,26 @@
|
||||
export function dasherize(name) {
|
||||
return ('' + name)
|
||||
.toLowerCase()
|
||||
.replace(/\s/g, '-')
|
||||
.replace(/[^a-z0-9\-\.]/gi, '')
|
||||
.replace(/\:/g, '');
|
||||
}
|
||||
|
||||
export function nameify(str) {
|
||||
return ('' + str)
|
||||
.replace(/[^a-zA-Z0-9\s]/g, '')
|
||||
.replace(/\:/g, '');
|
||||
}
|
||||
|
||||
export function unDasherize(name) {
|
||||
return ('' + name)
|
||||
// replace dash with space
|
||||
.replace(/\-/g, ' ')
|
||||
// strip nonalphanumarics chars except whitespace
|
||||
.replace(/[^a-zA-Z\d\s]/g, '')
|
||||
.trim();
|
||||
}
|
||||
|
||||
export function addPlaceholderImage(name) {
|
||||
return `https://identicon.org?t=${name}&s=256`;
|
||||
}
|
Reference in New Issue
Block a user