File tree Expand file tree Collapse file tree 1 file changed +11
-9
lines changed
services/one-app/src/common/utils Expand file tree Collapse file tree 1 file changed +11
-9
lines changed Original file line number Diff line number Diff line change @@ -12,15 +12,17 @@ export function isLexicalContent(content: unknown): content is LexicalNode {
1212 try {
1313 const parsed = JSON . parse ( content ) ;
1414
15- return (
16- parsed !== null &&
17- typeof parsed === 'object' &&
18- 'root' in parsed &&
19- typeof parsed . root === 'object' &&
20- parsed . root !== null &&
21- 'children' in parsed . root &&
22- Array . isArray ( parsed . root . children )
23- ) ;
15+ if ( ! parsed || typeof parsed !== 'object' ) return false ;
16+
17+ const { root } = parsed ;
18+
19+ if ( ! root || typeof root !== 'object' ) return false ;
20+
21+ const { children } = root ;
22+
23+ if ( ! children || ! Array . isArray ( children ) ) return false ;
24+
25+ return true ;
2426 } catch {
2527 return false ;
2628 }
You can’t perform that action at this time.
0 commit comments