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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@bible-help/parse-bible-verses

v1.0.6

Published

Parse text and expand osis references for Bible verses for use with AI and human interactions

Readme

Parse Bible Verses

Step 1. Take a string with bible verses in it and get a list of bible references back

"Read Genesis 1:1-2 and Matt.1.1 and Hebrews.1.1-2"

results in this response

{
    "text": "Read Gen.1.1-Gen.1,2 and Matt.1.1 and Heb.1.1-Heb.1.2",
    "references": [ "Gen.1.1-2", "Matthew 1:1", "Heb.1.1-Heb.1.2"]
}

Step 2. expand them into a list of osis bible verse references e.g.:

[
    "Gen.1.1",
    "Gen.1.2",
    "Matt.1.1",
    "Heb.1.1",
    "Heb.1.2"
]

This is useful for use cases involving AI / LLMs where you cannot guarantee getting a request that is perfectly formatted.

If you want a slimmer library just for parsing verses then take a look at bible-passage-reference-parser which is used under the hood by this library.

Associated Projects

For a interactive bible using the berean translation then take a look at: ai-BIBLE

For a mcp-server (Model Context Protocol) that you plugin to Claude Desktop and use to lookup bible verses then have a look at: MPC-Server

For a completions api that you can use with Open WebUI or Chat GPT via the completions api then have a look at: Completions-API-Server

Install

npm install @bible-help/parse-bible-verses

Usage

Basic Reference Parsing

import { expandBibleVerses } from "@bible-help/parse-bible-verses";

// Parse references to get individual verse list
const references = expandBibleVerses(["Gen.1.1-3", "John.3.16"]);
console.log(references);
// Output: ["Gen.1.1", "Gen.1.2", "Gen.1.3", "John.3.16"]

Text Processing with Bible References

import { parseTextForBibleVerses } from "@bible-help/parse-bible-verses";

// Parse text and replace Bible references with OSIS format
const result = parseTextForBibleVerses("Read John 3:16 and Matthew 5:3-4 for hope.");
console.log(result);
// Output: {
//   text: "Read John.3.16 and Matt.5.3-Matt.5.4 for hope.",
//   references: ["John.3.16", "Matt.5.3-Matt.5.4"]
// }

// Handle various book name formats
const result2 = parseTextForBibleVerses("Study Psalms 23 for comfort.");
console.log(result2);
// Output: {
//   text: "Study Ps.23.1-Ps.23.6 for comfort.",
//   references: ["Ps.23.1-Ps.23.6"]
// }

Book Name Recognition

import { isRecognisedBook } from "@bible-help/parse-bible-verses";

// Check if a book name is recognized (more flexible than standard OSIS validation)
console.log(isRecognisedBook("Genesis"));     // true
console.log(isRecognisedBook("Psalms"));      // true (handles variations)
console.log(isRecognisedBook("1 John"));      // true (handles numbered books)
console.log(isRecognisedBook("genessis"));    // true (handles misspellings)
console.log(isRecognisedBook("InvalidBook")); // false

API Reference

expandBibleVerses(references: string[], language?: string): string[]

Expands an array of Bible verse references and returns individual verse references in OSIS format.

Parameters:

  • references: Array of Bible verse references in various formats
  • language: Optional language parameter (default: "english")

Returns: Array of individual OSIS verse references

parseTextForBibleVerses(text: string): { text: string, references: string[] }

Parses text for Bible verse references and replaces them with OSIS formatted references.

Parameters:

  • text: Input text containing Bible verse references

Returns: Object containing:

  • text: Processed text with Bible references replaced with OSIS format
  • references: Array of OSIS reference ranges found, sorted naturally

Supported Formats:

  • Standard references: "John 3:16", "Matt 5:3-4"
  • Numbered books: "1 John 2:1", "2 Cor 3:16"
  • Chapter references: "Matthew 5", "Psalms 23"
  • Book name variations: "Psalms", "Genesis"
  • Dot notation: "Gen.1.1", "John.3.16"

isRecognisedBook(bookName: string): boolean

Checks if a book name is recognized in any format (more permissive than standard OSIS validation).

Parameters:

  • bookName: Book name to validate

Returns: Boolean indicating if the book name is recognized

Supported Formats:

  • OSIS codes: "Gen", "John", "1John"
  • Full names: "Genesis", "Matthew", "Revelation"
  • Common variations: "Psalms", "Pss"
  • Case variations: "genesis", "JOHN"
  • Misspellings and overrides: "genessis" → "Genesis"

Licence

This project is licensed under the MIT License.