CizgiRoman / src /lib /getValidString.ts
MorDizayn's picture
Upload 221 files
a9c43e2
Raw
History Blame Contribute Delete
223 Bytes
export function getValidString(something: any, defaultValue: string) {
const strValue = `${something || defaultValue}`
try {
return JSON.parse(strValue) || defaultValue
} catch (err) {
return defaultValue
}
}