File size: 223 Bytes
11d758a
 
 
 
 
 
 
 
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
  }
}