quran-pack
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

Quran-pack

Quran package is sourced from the website of the Ministry of Religion of the Republic of Indonesia.

Installation

Install package using npm.

npm i quran-pack

Features

  • Search surah by surah name or surah number.
  • Search for a specific surah verse.
  • Search for a specific surah verses with limit.
  • Equipped with Arabic, Latin text, translation and interpretation.
  • Supports extensible classes.

Quick Start

Import package

Import the package into your js/ts file with default import:

import * as Quran from 'quran-pack';

Import the package into your js/ts file with named import:

import { Surah } from 'quran-pack';

Declaration instance

const quran = Quran.surah('Al-Fatihah');
// or
const quran1 = Quran.surah(1);

or

const quran = new Surah('Al-Fatihah');
// or
const quran1 = new Surah(1);

Accessing property:

//...
quran.surahNumber; // 1
quran.name; // الفاتحة
quran.nameLatin; // Al-Fātiḥah
quran.nameID; // Al-Fatihah
quran.nameTranslateID; // Pembuka
quran.category; // Makkiyah
quran.numberOfVerse; // 7
quran.isMakkiyah; // true
quran.isMadaniyah; // false
quran.arabics; // object
quran.latins; // object
quran.translations; // object
quran.tafsirs; // object

Surah list

Quran.surahList; // list of surah

Use the provided methods:

const quran = Quran.surah('Al-Fatihah');
const verse = quran.getVerse(5); // return object surah al-fatihah verse 5.
const verses = quran.getVerses(1, 3); // return object surah alfatihah from verse 1 until verse 3, because the limit are 3 verses.

Result Quran.surah('Al-Fatihah').getVerse(5);, its mean Al-Fatihah verse 5.

{
  arabic: 'اِيَّاكَ نَعْبُدُ وَاِيَّاكَ نَسْتَعِيْنُۗ',
  latin: "Iyyāka na'budu wa iyyāka nasta'īn(u),",
  translation: {
    id: 'Hanya kepada Engkaulah kami menyembah ...'
  },
  tafsir: {
    id: {
      kemenag: 'Atas dasar itu semua, ...'
    }
  }
}

Result Quran.surah('Al-Fatihah').getVerses(1, 3);, its mean Al-Fatihah verses 1 - 3.

{
  hasPrev: false,
  hasNext: true,
  arabics: {
    '1': 'بِسْمِ اللّٰهِ الرَّحْمٰنِ الرَّحِيْمِ',
    '2': 'اَلْحَمْدُ لِلّٰهِ رَبِّ الْعٰلَمِيْنَۙ',
    '3': 'الرَّحْمٰنِ الرَّحِيْمِۙ'
  },
  latins: {
    '1': 'Bismillāhir-raḥmānir-raḥīm(i).',
    '2': "Al-ḥamdu lillāhi rabbil-'ālamīn(a).",
    '3': 'Ar-raḥmānir-raḥīm(i).'
  },
  translations: {
    id: {
      '1': 'Dengan nama Allah Yang Maha Pengasih lagi Maha Penyayang.',
      '2': 'Segala puji bagi Allah, Tuhan1) semesta alam',
      '3': 'Yang Maha Pengasih lagi Maha Penyayang,'
    }
  },
  tafsirs: {
    id: {
      kemenag: {
        '1': "Aku memulai bacaan Al-Qur'an ...",
        '2': "Segala puji kita persembahkan hanya untuk Allah semata ...",
        '3': "Dialah Yang Maha Pengasih, ...",
      }
    }
  }
}

Result Quran.surahList.

[
  {
    number: 1,
    name: 'الفاتحة',
    name_latin: 'Al-Fātiḥah',
    name_id: 'Al-Fatihah',
    name_trans_id: 'Pembuka',
    number_of_verse: 7,
    category: 'Makkiyah',
  },
  {
    number: 2,
    name: 'البقرة',
    name_latin: 'Al-Baqarah',
    name_id: 'Al-Baqarah',
    name_trans_id: 'Sapi',
    number_of_verse: 286,
    category: 'Madaniyah',
  },
  ...
];

Extensible Surah class

The Surah class is supports extensible that allow you to add additional methods or functions.

import { Surah } from 'quran-pack';

class MySurah extends Surah {
  constructor(value) {
    super(value);
    // ...
  }

  theMethod() {
    // ...
  }

  anotherMethod() {
    // ...
  }
}

const quran = new MySurah(1);
quran.theMethod(); // output
quran.anotherMethod(); // output

Package Sidebar

Install

npm i quran-pack

Weekly Downloads

9

Version

1.0.0

License

ISC

Unpacked Size

13.9 MB

Total Files

134

Last publish

Collaborators

  • sekhudinpbg3