refactor: mark dead exports with TODO, deduplicate field sanitization, fix import placement
This commit is contained in:
@@ -182,6 +182,15 @@ export function canonicalize(input: string): string {
|
||||
return input.normalize("NFC").trim();
|
||||
}
|
||||
|
||||
/** Normalize, trim and truncate a form field value to maxLen (default 255). */
|
||||
export function sanitizeField(
|
||||
value: FormDataEntryValue | null,
|
||||
maxLen = 255,
|
||||
): string {
|
||||
const s = canonicalize(String(value ?? ""));
|
||||
return s.slice(0, maxLen);
|
||||
}
|
||||
|
||||
const INVALID_FILENAME_CHARS = /[<>:"/\\|?*]/;
|
||||
|
||||
function removeControlChars(s: string): string {
|
||||
@@ -193,6 +202,7 @@ function removeControlChars(s: string): string {
|
||||
return result;
|
||||
}
|
||||
|
||||
// TODO: Check of dit weg kan — niet geïmporteerd in de codebase
|
||||
export function sanitizeFilename(name: string): string {
|
||||
return removeControlChars(
|
||||
name
|
||||
@@ -212,6 +222,7 @@ export function canonicalizeFormValue(
|
||||
return maxLen ? s.slice(0, maxLen) : s;
|
||||
}
|
||||
|
||||
// TODO: Check of dit weg kan — niet geïmporteerd in de codebase
|
||||
export function canonicalizeFormData(
|
||||
formData: FormData,
|
||||
fields: Record<string, number | undefined>,
|
||||
|
||||
Reference in New Issue
Block a user