@@ -19,27 +19,27 @@ export function mapCategoryKeyLabel(
19
19
}
20
20
21
21
/**
22
- * Sanitizes a string for display i.e. any empty, null or undefined value is sanitized to "Unspecified".
23
- * @param str - String to sanitize.
22
+ * Sanitizes a value to a string for display i.e. any empty, null or undefined value is sanitized to "Unspecified".
23
+ * @param value - Value to sanitize.
24
24
* @returns the string or sanitized string value.
25
25
*/
26
- export function sanitizeString ( str : string ) : string {
27
- if ( str === "" || str === null || str === undefined ) {
26
+ export function sanitizeString ( value : unknown ) : string {
27
+ if ( value === "" || value === null || value === undefined ) {
28
28
return "Unspecified" ;
29
29
} else {
30
- return str ;
30
+ return String ( value ) ;
31
31
}
32
32
}
33
33
34
34
/**
35
- * Sanitizes a string array for display i.e. any string element within the string array that is an empty, null or
35
+ * Sanitizes array elements to strings for display i.e. any element within the string array that is an empty, null or
36
36
* undefined value is sanitized to "Unspecified".
37
- * @param strArray - String array to sanitize.
37
+ * @param array - Array to sanitize.
38
38
* @returns the string array, sanitized.
39
39
*/
40
- export function sanitizeStringArray ( strArray : string [ ] ) : string [ ] {
41
- if ( ! strArray || strArray . length === 0 ) {
40
+ export function sanitizeStringArray ( array : unknown [ ] ) : string [ ] {
41
+ if ( ! array || array . length === 0 ) {
42
42
return [ "Unspecified" ] ;
43
43
}
44
- return strArray . map ( sanitizeString ) ;
44
+ return array . map ( sanitizeString ) ;
45
45
}
0 commit comments