syntax-muslim 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,47 @@
1
+ #!/usr/bin/env node
2
+ const https = require("https");
3
+ const WHITE = "\x1b[37m";
4
+ const GREEN = "\x1b[32m";
5
+ const RESET = "\x1b[0m";
6
+
7
+ const ayahCount = [
8
+ 7, 286, 200, 176, 120, 165, 206, 75, 129, 109, 123, 111, 43, 52, 99, 128, 111,
9
+ 110, 98, 135, 112, 78, 118, 64, 77, 227, 93, 88, 69, 60, 34, 30, 73, 54, 45, 83,
10
+ 182, 88, 75, 85, 54, 53, 89, 59, 37, 35, 38, 29, 18, 45, 60, 49, 62, 55, 78, 96,
11
+ 29, 22, 24, 13, 14, 11, 11, 18, 12, 12, 30, 52, 52, 44, 28, 28, 20, 56, 40, 31,
12
+ 50, 40, 46, 42, 29, 19, 36, 25, 22, 17, 19, 26, 30, 20, 15, 21, 11, 8, 8, 19,
13
+ 5, 8, 8, 11, 11, 8, 3, 9, 5, 4, 7, 3, 6, 3, 5, 4, 5, 6
14
+ ];
15
+
16
+ function run() {
17
+ const surah = Math.floor(Math.random() * 114) + 1;
18
+ const ayah = Math.floor(Math.random() * ayahCount[surah - 1]) + 1;
19
+ const url = `https://api.alquran.cloud/v1/ayah/${surah}:${ayah}/editions/quran-uthmani,id.indonesian`;
20
+
21
+ https.get(url, res => {
22
+ let data = "";
23
+ res.on("data", c => data += c);
24
+ res.on("end", () => {
25
+ try {
26
+ const json = JSON.parse(data);
27
+ const arab = json.data[0].text;
28
+ const indo = json.data.find(d => d.edition.type === "translation" && d.edition.language === "id")?.text;
29
+ const surahName = json.data[0].surah.englishName;
30
+ const ayahNumber = json.data[0].numberInSurah;
31
+
32
+ if (!indo) return run();
33
+
34
+ if (arab) {
35
+ console.log(`${WHITE}${arab}${RESET}`);
36
+ console.log(`QS. ${surahName}: ${ayahNumber}| artinya: ${GREEN}${indo}${RESET}`);
37
+ } else {
38
+ console.log(`${WHITE}QS. ${surahName}: ${ayahNumber} artinya: ${indo}${RESET}`);
39
+ }
40
+ } catch {
41
+ run();
42
+ }
43
+ });
44
+ }).on("error", run);
45
+ }
46
+
47
+ run();
package/package.json ADDED
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "syntax-muslim",
3
+ "version": "1.0.1",
4
+ "description": "",
5
+ "bin": {
6
+ "reminder": "./bin/reminder.js"
7
+ },
8
+ "scripts": {
9
+ "test": "echo \"Error: no test specified\" && exit 1"
10
+ },
11
+ "keywords": [],
12
+ "author": "",
13
+ "license": "ISC",
14
+ "type": "commonjs"
15
+ }
package/readme.md ADDED
@@ -0,0 +1,18 @@
1
+ ## syntax muslim
2
+ syntax muslim adalah tools sebagai pengingat kalian dalam menjalani kehidupan, perbanyak membaca alquran dan rasakan sendiri perubahan yang baik dalam diri kalian.
3
+
4
+ ## 📦 Instalasi
5
+ ```bash
6
+ npm install -g syntax-muslim
7
+ ```
8
+
9
+ ## 🚀 Penggunaan
10
+ ```bash
11
+ memorized
12
+ ```
13
+
14
+ ## 🎯 Fitur
15
+ pengingat kalian dalam menjalani kehidupan dengan ayat random yang ada di al-quran
16
+
17
+ ---
18
+ Dibuat oleh SyntaxCommunity