offline-search/index.html

19 lines
521 B
HTML
Raw Normal View History

2021-03-17 15:43:19 -04:00
<script>
fetch("data.csv")
.then(inAccept=>inAccept.text(), inReject=>{console.log("couldnt fetch", inReject)})
.then(inAccept=>{
let lines = inAccept.split(">");
lines.pop();
let output = [];
lines.forEach(line =>
{
let columns = line.split("|");
output.push({
title:columns[0],
id:columns[1],
topics:columns[2].split(",")
});
});
console.log(output);
})
</script>