Skip to content

Commit 50de227

Browse files
authored
Change to Boolean
1 parent f1c6d6f commit 50de227

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

dist/llms_txt_validation.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@ const fetchWithTimeout = (url) => {
88

99
return 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

Comments
 (0)