diff --git a/packages/nc-gui/utils/parseUtils.ts b/packages/nc-gui/utils/parseUtils.ts new file mode 100644 index 0000000000..9c989335c7 --- /dev/null +++ b/packages/nc-gui/utils/parseUtils.ts @@ -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 '{}' + } +}