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

daily-bread

v1.4.2

Published

TypeScript library for reading the Bible.

Downloads

15

Readme

DailyBread

This project is not affiliated with Bible Gateway.

DailyBread is a TypeScript library for reading the Bible. It is currently implemented by reading from Bible Gateway.

const bible = new DailyBread();
const passage = await bible.getOne('Matt 6:9-13');
console.log(passage.text);

Output:

⁹ “This, then, is how you should pray:

    “‘Our Father in heaven,
    hallowed be your name,
¹⁰  your kingdom come,
    your will be done,
      on earth as it is in heaven.
¹¹  Give us today our daily bread.
¹²  And forgive us our debts,
      as we also have forgiven our debtors.
¹³  And lead us not into temptation,
      but deliver us from the evil one.’

Install

To install, simply run the following command:

npm install --save daily-bread

Usage

DailyBread

DailyBread provides a simple library for reading one or more passages of the Bible in one of many supported versions. The DailyBread class is the primary interface for searching for Bible verses.

Finding a single passage or verse

You can search for a single passage by string:

import { DailyBread } from 'daily-bread';

const bible = new DailyBread();
const passage = await bible.getOne('Matt 11:28');
console.log(passage.text);

Output:

²⁸ “Come to me, all you who are weary and burdened, and I will give you rest.

The library will even preserve spacing for poetry:

const passage = await bible.getOne('Psalm 22:1-2');
console.log(passage.text);

Output:

¹ My God, my God, why have you forsaken me?
    Why are you so far from saving me,
    so far from my cries of anguish?
² My God, I cry out by day, but you do not answer,
    by night, but I find no rest.

You may also search using a reference object:

const passages = await bible.getOne({
  book: 'Genesis',
  from: { chapter: 1, verse: 1 },
  to: { chapter: 2, verse: 3 },
});

The library provides an enumeration for books of the Bible, allowing you to read the Bible completely programmatically:

import { CanonBook, DailyBread } from 'daily-bread';

...

const passage = await bible.getOne({
  book: CanonBook.Matthew,
  from: { chapter: 5 },
  to: { chapter: 7 },
});

Finding multiple passages

You can search for multiple passages at a time. As above, searches can be a single string or an array of references:

const passages = await bible.get('Matthew 7:12;Luke 6:31');
console.log(passages);

// Equivalently:
const passages = await bible.get([
  {
    book: CanonBook.Matthew,
    from: { chapter: 7, verse: 12 },
  },
  {
    book: CanonBook.Luke,
    from: { chapter: 6, verse: 31 },
  },
]);
console.log(passages);

Output:

[
  {
    reference: 'Matthew 7:12',
    text: '¹² So in everything, do to others what you would have them do to you, for this sums up the Law and the Prophets.'
  },
  {
    reference: 'Luke 6:31',
    text: '³¹ Do to others as you would have them do to you.'
  }
]

Verse of the day

You can read the verse of the day with a single method:

const bible = new DailyBread();
const votd = await bible.votd();
console.log(votd.text);

Setting Bible version

DailyBread currently supports several languages and translations. Language is tied to translation, so setting the Bible version will also use the associated language.

The following languages and translations are supported:

  • English: CEB, ESV, KJV, LEB, MSG,NIV, NKJV, NLT.
  • Spanish: NTV, NVI, RVC, RVR1960, RVA.
  • Chinese: CCB, CCBT, CNVS, CNVT, CUVS, CUV, CUVMPS, CUVMPT.
  • Korean: KLB.
  • Japanese: JLB.
  • Portuguese: ARC, NVT, NVI-PT.
  • French: LSG, NEG1979.
  • German: HOF, LUTH1545.
  • Italian: CEI, NR2006.
  • Hindi: ERV-HI.

The version currently being read can be changed directly on the DailyBread object:

// Check if version is supported before setting.
if (bible.isSupportedVersion('NLT')) {
  bible.setVersion('NLT');
}

// Set version directly.
bible.setVersion('esv');

Customizing passage formatting

There are several options for customizing the format of your passages:

bible.setFormatting({
  showVerseNumbers: false,
  preserveSmallCaps: true,
});
const passage = bible.getOne('Ex 3:14');
console.log(passage);

Output:

{
  reference: 'Exodus 3:14',
  text: 'God said to Moses, “I AM WHO I AM. This is what you are to say to the Israelites: ‘I AM has sent me to you.’”'
}

BibleGatewayWebScraper

The DailyBread class is intended to be a standard library for reading the Bible programmatically. For more flexibility, you may use the BibleGatewayWebScraper directly, which allows direct access to the Bible Gateway website.

const scraper = new BibleGatewayWebScraper('ESV');
const passages = await scraper.passages('1 cor 13:4;gal 6:9');
console.log(passages);

Output:

[
  {
    reference: '1 Corinthians 13:4',
    text: '⁴ Love is patient and kind; love does not envy or boast; it is not arrogant'
  },
  {
    reference: 'Galatians 6:9',
    text: '⁹ And let us not grow weary of doing good, for in due season we will reap, if we do not give up.'
  }
]

CLI

A CLI that uses DailyBread comes bundled with the NPM package. It can be called from the command line using npx daily-bread.

npx daily-bread -v esv rom 12

npx daily-bread book acts of the apostles

npx daily-bread books

Features

  • DailyBread class
    • Read one or more passages from the Bible from a supported version with customizable formatting.
    • Get information about a canon or deuterocanon book of the Bible.
    • Read Verse of the Day.
  • BibleGatewayWebScraper class
    • Read passages from Bible Gateway for any version with customizable formatting.
    • Read Verse of the Day.

Planned Features

  • Search for verses by word.