Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

chapter-and-verse

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chapter-and-verse

Given a bible reference returns an object with the bible book, chapter, verse and more

  • 1.1.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
33
increased by230%
Maintainers
1
Weekly downloads
 
Created
Source

chapter-and-verse

build coverage npm dependencies downloads

Given a bible reference returns an object with the bible book, chapter, verse and more


Introduction

Throw a bible reference at chapter-and-verse and it returns a detailed JSON object for that reference.

chapter-and-verse understands all common bible book abbreviations and more.

It is particularly useful when formulating bible reference based URLs and for dealing with complex bible APIs / raw user input.

chapter-and-verse handles all the following reference formats:

formatexamplenotes
bookGenesis
book chapterGenesis 5
book verseObadiah 3single chapter books only
book versesObadiah 3-5single chapter books only
book chapter:verseGenesis 5:1
book chapter:versesGenesis 5:1-4

chapter-and-verse is written by a professional developer, has 100% unit test coverage and is ready for production use.


Usage

const chapterAndVerse = require('chapter-and-verse')
let cv = chapterAndVerse('Dan 4:1-3')

And cv now looks like:

{
  "book": {
    "id": "Dan",
    "name": "Daniel",
    "testament": "O",
    "start": "dan",
    "abbr": ["da", "dn"],
    "chapters": 12
  },
  "reason": "matches book.id",
  "chapter": 4,
  "from": 1,
  "to": 3,
  "range": [1, 2, 3]
}

Methods

Use cv.toString() and cv.toShortString() as follows:

cv = chapterAndVerse('Dan 4:1-3')
cv.toString() // returns 'Daniel 4:1-3'
cv.toShortString() // returns 'Daniel 4:1-3' .. no difference because Daniel has multiple chapters

cv = chapterAndVerse('ob 1-3')
cv.toString() // returns 'Obadiah 1:1-3'
cv.toShortString() // returns 'Obadiah 1-3' .. difference because Obadiah only has a single chapter

cv.getType() returns one of 'book', 'chapter', 'verses' or 'verse'

Finally cv.toSimpleObject() provides access to a flat object containing only essential data:

cv = chapterAndVerse('exo 33:7-12')
cv.toSimpleObject()

Which returns:

{
  "type": "verses",
  "asString": "Exodus 33:7-12",
  "asShortString": "Exodus 33:7-12",
  "bookId": "Exod",
  "bookName": "Exodus",
  "testament": "O",
  "chapter": 33,
  "from": 7,
  "to": 12,
  "range": [7, 8, 9, 10, 11, 12]
}

Validation

chapter-and-verse returns null if it cannot resolve the biblical reference.

This happens when the:

  • Reference is not in one of the six supported formats above

  • Book cannot be determined from the reference given

  • Chapter number is invalid for the book in question

  • verse from and verse to are not in the range 1-176 - see Psalm 119:176 ESV

chapter-and-verse does NOT return null if the verse range is invalid for the chapter in question; being beyond the intended scope.

chapter-and-verse is NOT intended to recognise apocryphal books.


Author says

The Lord bless you and keep you;

the Lord make his face to shine upon you and be gracious to you;

the Lord lift up his countenance upon you and give you peace.

Numbers 6:24-26 ESV




Keywords

FAQs

Package last updated on 10 Feb 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc