From 540604f6268d9ee375440f6b27b2a564e3bed729 Mon Sep 17 00:00:00 2001 From: Ahmad Bilal Date: Fri, 30 Aug 2024 13:30:35 +0500 Subject: [PATCH] chore: add readme file with examples --- package.json | 42 ++++++++++++++++++++++++++++++++++ src/calander/hijri-calander.ts | 4 ++-- src/quran/quran.ts | 4 ++-- src/types/dialect.enum.ts | 2 +- 4 files changed, 47 insertions(+), 5 deletions(-) create mode 100644 package.json diff --git a/package.json b/package.json new file mode 100644 index 0000000..42d1ff4 --- /dev/null +++ b/package.json @@ -0,0 +1,42 @@ +{ + "name": "islam.js", + "version": "1.0.0", + "description": "This is the initial commit.", + "main": "index.js", + "scripts": { + "lint": "eslint", + "lint:fix": "eslint --fix", + "start": "npx ts-node src/test.ts", + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/dev-ahmadbilal/islam.js.git" + }, + "keywords": [ + "islam.js", + "islam", + "quran", + "hadith", + "prayer", + "azkar" + ], + "author": "Ahmad Bilal", + "license": "MIT", + "bugs": { + "url": "https://github.com/dev-ahmadbilal/islam.js/issues" + }, + "homepage": "https://github.com/dev-ahmadbilal/islam.js#readme", + "devDependencies": { + "@eslint/js": "^9.9.1", + "@types/node": "^22.5.0", + "eslint": "^9.9.1", + "eslint-config-prettier": "^9.1.0", + "eslint-plugin-prettier": "^5.2.1", + "globals": "^15.9.0", + "prettier": "3.3.3", + "ts-node": "^10.9.2", + "typescript": "^5.5.4", + "typescript-eslint": "^8.3.0" + } +} diff --git a/src/calander/hijri-calander.ts b/src/calander/hijri-calander.ts index 48a9d62..d0ad654 100644 --- a/src/calander/hijri-calander.ts +++ b/src/calander/hijri-calander.ts @@ -28,7 +28,7 @@ export class HijriCalendar { if (!response.ok) { throw new Error(`Failed to fetch Hijri date by location: ${response.statusText}`); } - const data: PrayerApiResponse = await response.json(); + const data = (await response.json()) as PrayerApiResponse; return data.data.date.hijri; } catch (error) { console.error(error); @@ -50,7 +50,7 @@ export class HijriCalendar { if (!response.ok) { throw new Error(`Failed to fetch Hijri date by city: ${response.statusText}`); } - const data: PrayerApiResponse = await response.json(); + const data = (await response.json()) as PrayerApiResponse; return data.data.date.hijri; } catch (error) { console.error(error); diff --git a/src/quran/quran.ts b/src/quran/quran.ts index ce1d5dd..1fab78c 100644 --- a/src/quran/quran.ts +++ b/src/quran/quran.ts @@ -29,11 +29,11 @@ export class Quran { /** * Get a Chapter by its name. - * @param name - The name of the Chapter in Arabic. + * @param name - The name of the Chapter in English. * @returns The Chapter object or undefined if not found. */ public getChapterByName(name: string): Chapter | undefined { - return this.quran.find((obj) => obj.name === name); + return this.quran.find((obj) => obj.englishName === name); } /** diff --git a/src/types/dialect.enum.ts b/src/types/dialect.enum.ts index a8d8c3a..95e8351 100644 --- a/src/types/dialect.enum.ts +++ b/src/types/dialect.enum.ts @@ -1,4 +1,4 @@ export enum DialectEnum { Hafs = 'hafs', - Watsh = 'warsh', + Warsh = 'warsh', }