初始化模版工程
This commit is contained in:
10
package/utils/parse.ts
Normal file
10
package/utils/parse.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
|
||||
export function tryParseToObject(json: string) {
|
||||
if (typeof json === 'object') return json
|
||||
|
||||
try {
|
||||
return JSON.parse(json)
|
||||
} catch {
|
||||
return {}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user