-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
33 lines (26 loc) · 1.34 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
const sqliteJSON = require('sqlite-json');
const fs = require('fs');
const exporter = sqliteJSON('quran.ar_naskh.db');
exporter.json("SELECT * FROM arabic_text", function (error, json) {
var json = JSON.parse(json);
fs.readFile("ayats_ar.json", "utf8", (error, data) => {
var ayats_ar_without_indopak = JSON.parse(data);
for (let i = 0; i < ayats_ar_without_indopak.length; i++) {
if (json[i].sura == ayats_ar_without_indopak[i].sura && json[i].ayah == ayats_ar_without_indopak[i].VerseIDAr) {
// Rename VerseIDAr to aya
ayats_ar_without_indopak[i].aya = ayats_ar_without_indopak[i].VerseIDAr;
delete ayats_ar_without_indopak[i].VerseIDAr;
// Rename ayat to text
ayats_ar_without_indopak[i].text = ayats_ar_without_indopak[i].ayat;
delete ayats_ar_without_indopak[i].ayat;
// Add indo-pak text
ayats_ar_without_indopak[i].text_indopak = json[i].text;
} else {
console.warn("Warning: Skipping ayat! to avoid this please use Sqlite query to perform best!");
}
}
writeStream = fs.createWriteStream("./output/ayats_ar_with_indopak.json");
writeStream.write(JSON.stringify(ayats_ar_without_indopak));
writeStream.end();
});
});