feat: url scraper to recipe
This commit is contained in:
@@ -6,17 +6,10 @@ export function formatDate(date: Date): string {
|
||||
}
|
||||
|
||||
export function safeFileName(inputString: string): string {
|
||||
// Convert the string to lowercase
|
||||
let fileName = inputString.toLowerCase();
|
||||
|
||||
// Replace spaces with underscores
|
||||
fileName = fileName.replace(/ /g, "_");
|
||||
|
||||
// Remove characters that are not safe for file names
|
||||
fileName = fileName.replace(/[^\w.-]/g, "");
|
||||
|
||||
fileName = fileName.replaceAll(":", "");
|
||||
|
||||
return fileName;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user