refactor: dedupe trim string helpers

This commit is contained in:
Peter Steinberger
2026-04-07 09:17:29 +01:00
parent 8119915664
commit 365d5a410b
6 changed files with 18 additions and 34 deletions

View File

@@ -1,11 +1,10 @@
import { normalizeOptionalString } from "./string-coerce.js";
export function coerceIdentityValue(
value: string | undefined,
maxLength: number,
): string | undefined {
if (typeof value !== "string") {
return undefined;
}
const trimmed = value.trim();
const trimmed = normalizeOptionalString(value);
if (!trimmed) {
return undefined;
}