mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-03 06:47:33 +00:00
* Add ESLint config * Add ESLint packages * Add prettier config * Fix ESLint package version * Format all files * Format static assets * Format project root config * Add pre-commit code formatting Formats .css & .js files automatically. If any .ts or .mts files are staged, the entire project is type-checked. Packages: - lint-staged - husky - prettier
18 lines
601 B
TypeScript
18 lines
601 B
TypeScript
/**
|
|
* Uses the standard String() function to coerce to string, unless the value is null or undefined - then null.
|
|
* @param value The value to convert
|
|
* @returns String(value) or null
|
|
*/
|
|
export function stringOrNull(value: unknown): string | null {
|
|
return value == null ? null : String(value)
|
|
}
|
|
|
|
/**
|
|
* Uses the standard String() function to coerce to string, unless the value is null or undefined - then an empty string
|
|
* @param value The value to convert
|
|
* @returns String(value) or ""
|
|
*/
|
|
export function stringOrEmpty(value: unknown): string {
|
|
return value == null ? "" : String(value)
|
|
}
|