|
|
/**
|
|
* Add better assurance that a generated file name will be safe
|
|
*/
|
|
export function safeTitleFileName(title: string) {
|
|
title = title.replace(/(?<=\S):\s/g, " - ");
|
|
title = title.replace(/[\<\>\|\:\/\\]/g, " ");
|
|
title = title.replace(/\s\&\s/g, " and ");
|
|
title = title.trim();
|
|
return title[0].toUpperCase() + title.slice(1);
|
|
}
|