npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@mosqueicu/islamic_prayer_times

v0.0.4

Published

npm package for islamic texts

Downloads

37

Readme

# islamic_prayer_times NPM

The islamic prayer times NPM package
simplifies access to Islamic prayer
times data for developers. This package
extends the functionality of the Prayer
Times API repository to provide an
easy-to-use interface for retrieving
prayer times information.

## Installation

You can install the Sacred Texts NPM
package via npm:

```bash
npm i @mosqueicu/islamic_prayer_times
```

importing the package

Import the package in your code:

const islamic_prayer_times = require('@mosqueicu/islamic_prayer_times');

Functions

getPrayerTimes Function

Description

The getPrayerTimes function is a JavaScript function for fetching daily prayer times based on various parameters such as date, location coordinates, calculation method, and other optional settings. It utilizes the Aladhan API to retrieve accurate prayer times.

Usage

To use this function, you need to import it into your JavaScript/TypeScript project. Here's how you can import it:

import { getPrayerTimes } from '@mosqueicu/islamic_prayer_times';

Function Signature

async function getPrayerTimes(options): Promise<any>

Parameters

  • options (required): An object of type PrayerTimeOptions containing the following properties:
    • date (string, required): The date for which you want to fetch prayer times in the format 'DD-MM-YYYY'.
    • latitude (number, required): The latitude of the location for which you want to fetch prayer times.
    • longitude (number, required): The longitude of the location for which you want to fetch prayer times.
    • method (number, optional): The calculation method for prayer times. Defaults to null.
    • shafaq (number, optional): The shafaq method for prayer times. Defaults to null.
    • tune (number, optional): The tune method for prayer times. Defaults to null.
    • school (number, optional): The school of jurisprudence for prayer times. Defaults to null.
    • midnightMode (number, optional): The midnight mode for prayer times. Defaults to null.
    • timezonestring (string, optional): The time zone string for the location. Defaults to null.
    • latitudeAdjustmentMethod (string, optional): The latitude adjustment method for prayer times. Defaults to null.
    • adjustment (number, optional): The adjustment for prayer times. Defaults to null.
    • iso8601 (boolean, optional): Whether to return prayer times in ISO8601 format. Defaults to null.

Returns

  • A Promise that resolves to an object containing the prayer times data or rejects with an error if the request fails.

Example

Here's an example of how to use the getPrayerTimes function:

const options: PrayerTimeOptions = {
	date: '17-07-2007',
	latitude: 51.508515,
	longitude: -0.1254872,
	method: 2, // Calculation method (optional)
};

getPrayerTimes(options)
	.then((data) => {
		console.log(data); // Print the retrieved prayer times data
	})
	.catch((error) => {
		console.error(error); // Handle any errors that occur during the request
	});

In this example, you specify the date and location coordinates in the options object and, if needed, additional parameters for calculation methods. The function then makes an API request to fetch the daily prayer times and returns the data.

Error Handling

The function handles errors by rejecting the Promise if there is a failure in fetching the data. You can catch these errors and handle them as needed.

Error Object

The error object thrown by the function will include an error message indicating the reason for the failure.

Error: Failed to fetch prayer times: [error message]

API Endpoint

The function uses the Aladhan API to retrieve prayer times data. The API endpoint is constructed based on the provided date.

  • API Endpoint: http://api.aladhan.com/v1/timings/[date]

Please note that you need an internet connection to access the API.

License

This function is provided under [your project's license].

Credits

This function was developed by MosqueICU. If you have any questions or need support, please contact us on https://discord.gg/WtKVyeeDrZ or visit our website at https://mosque.icu.

License

This package is released under the MIT license.