File size: 352 Bytes
947c08e
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
export function ensure_safe_table_name(item: string): string {
    // Define the pattern for allowed characters (alphanumeric, underscore, and Unicode characters)
    const pattern = /[^\p{L}\p{N}_-]/gu;
    
    // Replace illegal characters with an underscore
    const safe_table_name = item.replace(pattern, '_');
    
    return safe_table_name;
}