File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change 11//[llms-txt-valid]
22return fetch ( '/llms.txt' )
33 . then ( response => {
4- if ( ! response . ok ) return 0 ;
4+ if ( ! response . ok ) return { "exists" : 0 , "valid" : 0 } ;
55 const ct = response . headers . get ( 'Content-Type' ) || '' ;
6- if ( ! ct . toLowerCase ( ) . includes ( 'text/plain' ) ) return 0 ;
6+ if ( ! ct . toLowerCase ( ) . includes ( 'text/plain' ) ) return { "exists" : 1 , "valid" : 0 } ;
77 return response . text ( ) . then ( text => {
88 const m = s => ( text . match ( new RegExp ( `\\${ s } ` , 'g' ) ) || [ ] ) . length ;
9- if ( ( text . match ( / ` ` ` / g) || [ ] ) . length % 2 ) return 0 ;
10- if ( m ( '[' ) !== m ( ']' ) || m ( '(' ) !== m ( ')' ) ) return 0 ;
11- return 1 ;
9+ if ( ( text . match ( / ` ` ` / g) || [ ] ) . length % 2 ) return { "exists" : 1 , "valid" : 0 } ;
10+ if ( m ( '[' ) !== m ( ']' ) || m ( '(' ) !== m ( ')' ) ) return { "exists" : 1 , "valid" : 0 } ;
11+ return { "exists" : 1 , "valid" : 1 } ;
1212 } ) ;
1313 } )
1414 . catch ( error => {
You can’t perform that action at this time.
0 commit comments