File size: 223 Bytes
450060f
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
export function getValidString(something: any, defaultValue: string) {
  const strValue = `${something || defaultValue}`
  try {
   return JSON.parse(strValue) || defaultValue
  } catch (err) {
    return defaultValue
  }
}