mirror of
https://github.com/hanzoai/sentinel.git
synced 2026-09-29 22:34:33 +00:00
13 lines
385 B
TypeScript
13 lines
385 B
TypeScript
/**
|
|
* Sanitizes a string so that it can be used as a query selector
|
|
*
|
|
* e.g. `feedback:branding` --> `feedback-branding` or
|
|
* 'Data Scrubbing' --> 'Data-Scrubbing'
|
|
*
|
|
* @param str The string to sanitize
|
|
* @return Returns a sanitized string (replace
|
|
*/
|
|
export function sanitizeQuerySelector(str: string) {
|
|
return typeof str === 'string' ? str.replace(/[ :+/.]+/g, '-') : '';
|
|
}
|