workflow-comics / src /lib /getValidString.ts
zanekwok's picture
init
450060f
raw
history blame
223 Bytes
export function getValidString(something: any, defaultValue: string) {
const strValue = `${something || defaultValue}`
try {
return JSON.parse(strValue) || defaultValue
} catch (err) {
return defaultValue
}
}