mirror of https://github.com/nocodb/nocodb
Wing-Kam Wong
2 years ago
1 changed files with 17 additions and 0 deletions
@ -0,0 +1,17 @@
|
||||
export function parseProp(v: any): any { |
||||
if (!v) return |
||||
try { |
||||
return typeof v === 'string' ? JSON.parse(v) : v |
||||
} catch { |
||||
return {} |
||||
} |
||||
} |
||||
|
||||
export function stringifyProp(v: any): string | void { |
||||
if (!v) return |
||||
try { |
||||
return typeof v === 'string' ? v : JSON.stringify(v) |
||||
} catch { |
||||
return '{}' |
||||
} |
||||
} |
Loading…
Reference in new issue