9 lines
367 B
TypeScript
9 lines
367 B
TypeScript
/** 그리드/폼 문자열 → API 전송용. 빈값·공백만이면 null */
|
|
export function nullableTrimmedString(
|
|
value: string | number | null | undefined | unknown,
|
|
): string | null {
|
|
if (value === null || value === undefined) return null;
|
|
const s = typeof value === "string" ? value.trim() : String(value).trim();
|
|
return s === "" ? null : s;
|
|
}
|