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

gitaverse

v1.0.0

Published

A TypeScript library to access Bhagavad Gita shlokas, translations, and metadata.

Downloads

54

Readme

logo

GitaVerse

A TypeScript library to access Bhagavad Gita shlokas, translations, and metadata. This library allows developers to fetch chapters, verses, and complete shloka details from the Bhagavad Gita, including the translations and synonyms.


📖 Description

The Gita Library provides a structured and programmatic way to access the verses (shlokas) of the Bhagavad Gita. Whether you're building a spiritual application, research tool, or educational platform, this library makes accessing Gita's wisdom easy and developer-friendly.


🚀 Features

  • Fetch all verses in a chapter.
  • Get specific shlokas by chapter and verse number.
  • Retrieve detailed translations, synonyms, and Devanagari text.
  • Group shlokas by chapters.
  • Includes metadata about the Bhagavad Gita.

📦 Installation

Install the library using npm:

npm install gitaverse

or using yarn:

yarn add gitaverse

🔧 Usage

Here is an example of how to use the Gita Verse.

Import and Initialize the Library

import { GitaLibrary } from "gita-library";

const gita = new GitaLibrary();

1. Get Metadata About the Gita

const metadata = gita.getDescription();
console.log(metadata);
/*
Output:
{
  title: "Bhagavad Gita",
  description: "The Bhagavad Gita, often referred to as the Gita, is a 700-verse Hindu scripture that is part of the Indian epic Mahabharata.",
  totalChapters: 18,
  totalVerses: 700
}
*/

2. Fetch All Shlokas in a Chapter

const chapter1Shlokas = gita.getChapter(1);
console.log(chapter1Shlokas.map((shloka) => shloka.getSummary()));

3. Fetch a Specific Shloka by Chapter and Verse Number

const shloka = gita.getShloka(1, 1);
console.log(shloka.getSummary());
/*
Output:
{
  chapter: "1",
  verse: "1",
  devanagari: "धृतराष्ट्र उवाच...",
  verseText: "Dhritarashtra said...",
  synonyms: "Dhritarashtra - King Dhritarashtra...",
  translation: "King Dhritarashtra inquired...",
  meaning: ["Literal meaning of the verse...", "Deeper spiritual significance..."]
}
*/

4. Fetch All Verses Grouped by Chapter

const allVerses = gita.getAllVerses();
allVerses.forEach((chapter) => {
  console.log(`Chapter ${chapter.getShlokas().length} Shlokas`);
});

📚 API Reference

GitaLibrary Methods:

  • getDescription(): Returns Gita metadata.
  • getChapter(chapterNumber: number): Returns all shlokas for the specified chapter.
  • getShloka(chapterNumber: number, verseNumber: number): Returns a specific shloka.
  • getAllVerses(): Fetches all verses grouped by chapters.

GitaShloka Methods:

  • getSummary(): Returns a structured summary of the shloka.
  • getChapter(): Returns the chapter number.
  • getVerse(): Returns the verse number.
  • getDevanagari(): Returns the verse in Devanagari script.
  • getVerseText(): Returns the verse text.
  • getTranslation(): Returns the translation.
  • getMeaning(): Returns the meaning of the shloka.

🛠 Contributing

Contributions are welcome! To contribute:

  1. Fork the repository.
  2. Create a feature branch.
  3. Submit a Pull Request.

🐞 Issues

If you encounter any bugs or have feature requests, please create an issue on the GitHub repository.


📄 License

This project is licensed under the MIT License - see the LICENSE file for details.


🌟 Show Your Support

If you like this library, please ⭐ the repository and share it with others who might find it useful!


✨ Stay Inspired

"You have the right to work, but never to the fruit of work."Bhagavad Gita (Chapter 2, Verse 47)