Spaces:
Runtime error
Runtime error
Download src/lib/getValidString.ts from mereojb/ai-comic-factory: direct link, hf CLI and curl.
- Browser
- Download file 223 Bytes
-
https://huggingface.co/spaces/mereojb/ai-comic-factory/resolve/main/src/lib/getValidString.ts
- Command line
-
hf download hf://spaces/mereojb/ai-comic-factory/src/lib/getValidString.ts
-
curl -L -o getValidString.ts https://huggingface.co/spaces/mereojb/ai-comic-factory/resolve/main/src/lib/getValidString.ts
223 Bytes
| export function getValidString(something: any, defaultValue: string) { | |
| const strValue = `${something || defaultValue}` | |
| try { | |
| return JSON.parse(strValue) || defaultValue | |
| } catch (err) { | |
| return defaultValue | |
| } | |
| } |