mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-22 18:31:57 +03:00
8 lines
338 B
JavaScript
8 lines
338 B
JavaScript
export default function prettifyFileName(filename) {
|
|
if (!filename || typeof filename !== 'string') {
|
|
return '';
|
|
}
|
|
let updatedName = filename.split('.').slice(0, -1).join('.').replace(/[-_]/g,' ').replace(/[^\w\s]+/g,'').replace(/\s\s+/g, ' ');
|
|
return updatedName.charAt(0).toUpperCase() + updatedName.slice(1);
|
|
}
|