Browse Source

refactor(nc-gui): revise parseUtil

pull/5307/head
Wing-Kam Wong 2 years ago
parent
commit
a2367c9227
  1. 6
      packages/nc-gui/utils/parseUtils.ts

6
packages/nc-gui/utils/parseUtils.ts

@ -1,5 +1,5 @@
export function parseProp(v: any): any { export function parseProp(v: any): any {
if (!v) return if (!v) return {}
try { try {
return typeof v === 'string' ? JSON.parse(v) : v return typeof v === 'string' ? JSON.parse(v) : v
} catch { } catch {
@ -7,8 +7,8 @@ export function parseProp(v: any): any {
} }
} }
export function stringifyProp(v: any): string | void { export function stringifyProp(v: any): string | undefined {
if (!v) return if (!v) return undefined
try { try {
return typeof v === 'string' ? v : JSON.stringify(v) return typeof v === 'string' ? v : JSON.stringify(v)
} catch { } catch {

Loading…
Cancel
Save