@@ -8,16 +8,16 @@ const fetchWithTimeout = (url) => {
88
99return fetchWithTimeout ( '/llms.txt' )
1010 . then ( response => {
11- if ( ! response . ok ) return JSON . stringify ( { valid :0 , message : response . status , error : "Non OK status code" } ) ;
11+ if ( ! response . ok ) return JSON . stringify ( { valid : false , message : response . status , error : "Non OK status code" } ) ;
1212 const ct = response . headers . get ( 'Content-Type' ) || '' ;
13- if ( ! ct . toLowerCase ( ) . includes ( 'text/plain' ) ) return JSON . stringify ( { valid :0 , message : ct , error : "Invalid content type" } ) ;
13+ if ( ! ct . toLowerCase ( ) . includes ( 'text/plain' ) ) return JSON . stringify ( { valid : false , message : ct , error : "Invalid content type" } ) ;
1414 return response . text ( ) . then ( text => {
1515 const m = s => ( text . match ( new RegExp ( `\\${ s } ` , 'g' ) ) || [ ] ) . length ;
16- if ( m ( '[' ) !== m ( ']' ) || m ( '(' ) !== m ( ')' ) ) return JSON . stringify ( { valid :0 , error :"Invalid markdown: Unmatched braces" } ) ;
17- if ( ( text . match ( / ` ` ` / g) || [ ] ) . length % 2 ) return JSON . stringify ( { valid :0 , error :"Invalid markdown: Uneven code fences" } ) ;
18- return JSON . stringify ( { valid :1 } ) ;
16+ if ( m ( '[' ) !== m ( ']' ) || m ( '(' ) !== m ( ')' ) ) return JSON . stringify ( { valid : false , error : "Invalid markdown: Unmatched braces" } ) ;
17+ if ( ( text . match ( / ` ` ` / g) || [ ] ) . length % 2 ) return JSON . stringify ( { valid : false , error : "Invalid markdown: Uneven code fences" } ) ;
18+ return JSON . stringify ( { valid : true } ) ;
1919 } ) ;
2020 } )
2121 . catch ( error => {
22- return JSON . stringify ( { valid :0 , message : error . message , error : error } ) ;
22+ return JSON . stringify ( { valid : false , message : error . message , error : error } ) ;
2323 } ) ;
0 commit comments