feat: add isVailedJSON utility function for JSON validation

This commit is contained in:
ecwu
2025-01-04 23:53:28 +08:00
parent 503bf6a9bb
commit f3d08afcdd

View File

@@ -0,0 +1,8 @@
export const isVailedJSON = (str: string): boolean => {
try {
JSON.parse(str);
} catch (e) {
return false;
}
return true;
};