27 lines
533 B
JavaScript
27 lines
533 B
JavaScript
export const API_URL = 'http://18.213.12.22:3001';
|
|
|
|
export const slugify = (text) => {
|
|
if (!text) {
|
|
return '';
|
|
}
|
|
|
|
return text
|
|
.toString()
|
|
.toLowerCase()
|
|
.trim()
|
|
.replace(/\s+/g, '-')
|
|
.replace(/[^\w\-]+/g, '')
|
|
.replace(/\-\-+/g, '-');
|
|
};
|
|
|
|
export const unSlugify = (text) => {
|
|
if (!text) {
|
|
return '';
|
|
}
|
|
|
|
return text
|
|
.toString()
|
|
.toLowerCase()
|
|
.replace(/-/g, ' ')
|
|
.replace(/\b\w/g, (char) => char.toUpperCase());
|
|
}; |