New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

scripture-guide

Package Overview
Dependencies
Maintainers
1
Versions
86
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

scripture-guide

A utility for biblical and scripture reference parsing that enables structured queries based on strings of traditional scripture references (e.g. John 3:16).

latest
Source
npmnpm
Version
1.0.87
Version published
Maintainers
1
Created
Source

Scripture Guide

A multilingual scripture reference parser for looking up, generating, and detecting scripture references across multiple religious canons.

scripture.guide

Features

  • Parse references - Convert "John 3:16" to verse IDs
  • Generate references - Convert verse IDs back to human-readable strings
  • Detect references - Find and link scripture references in text
  • 12 languages - English, Korean, German, French, Russian, Vietnamese, Swedish, Tagalog, Japanese, Turkish, Slovenian, Esperanto
  • Multiple canons - Bible, LDS, RLDS, Hindu, Buddhist, Islamic texts
  • Context-aware detection - Recognizes implied references like "v. 16" and "vv. 17-18"

Installation

npm install scripture-guide

Quick Start

import { lookupReference, generateReference, detectReferences } from 'scripture-guide';

// Parse a reference to verse IDs
lookupReference('John 3:16');
// { query: 'John 3:16', ref: 'John 3:16', verse_ids: [26137] }

// Generate a reference from verse IDs
generateReference([26137, 26138, 26139]);
// 'John 3:16-18'

// Detect and link references in text
detectReferences('Read John 3:16 today.', (ref, ids) => `<a href="/v/${ids[0]}">${ref}</a>`);
// 'Read <a href="/v/26137">John 3:16</a> today.'

API Reference

lookupReference(query, options?)

Parse a scripture reference string into verse IDs.

lookupReference('Mt 5:3-12');
// { query: 'Mt 5:3-12', ref: 'Matthew 5:3-12', verse_ids: [23239, 23240, ...] }

lookupReference('Genesis 1:1', 'ko');  // string options = language
// { query: 'Genesis 1:1', ref: '창세기 1:1', verse_ids: [1] }

lookupReference('1 Nephi 3:7', { language: 'en', canon: 'lds' });
// { query: '1 Nephi 3:7', ref: '1 Nephi 3:7', verse_ids: [23152] }

Parameters:

NameTypeDescription
querystringScripture reference to parse
optionsstring | objectIf string, treated as language code
options.languagestringLanguage code
options.canonstringCanon: 'lds', 'rlds', etc.

Backward Compatibility: The old 3-parameter signature lookupReference(query, language, config) is deprecated but still supported.

Returns:

{
  query: string;        // Original input
  ref: string;          // Normalized reference
  verse_ids: number[];  // Verse ID array
  error?: string;       // Error message if failed
}

generateReference(verse_ids, options?)

Convert verse IDs to a formatted reference string.

generateReference([1, 2, 3]);
// 'Genesis 1:1-3'

generateReference([26137], 'de');  // string options = language
// 'Johannes 3:16'

generateReference([1, 2, 3, 10, 11], { language: 'en', canon: 'lds' });
// 'Genesis 1:1-3, 10-11'

Parameters:

NameTypeDescription
verse_idsnumber[]Array of verse IDs
optionsstring | objectIf string, treated as language code
options.languagestringLanguage code
options.canonstringCanon: 'lds', 'rlds', etc.

Backward Compatibility: The old 3-parameter signature generateReference(ids, language, options) is deprecated but still supported.

detectReferences(content, callback?, options?)

Find scripture references in text and optionally transform them.

// Default: wrap in brackets
detectReferences('See Matthew 5:3-12 and John 3:16.');
// 'See [Matthew 5:3-12] and [John 3:16].'

// Custom callback
detectReferences('Read John 3:16.', (ref, ids) => {
  return `<a href="/bible/${ids.join(',')}">${ref}</a>`;
});

// Context-aware: detects "v. 16" from surrounding context
detectReferences('In John 3, Jesus explains (v. 16) that God loved the world.');
// Detects 'John 3:16'

Parameters:

NameTypeDescription
contentstringText containing references
callbackfunction(query, verseIds) => string
options.languagestringLanguage code
options.contextAwarebooleanEnable context detection (default: true)
options.enableImpliedBooksbooleanDetect bare verse numbers (default: true)

setLanguage(language)

Set the default language for all subsequent calls.

import { setLanguage, lookupReference } from 'scripture-guide';

setLanguage('ko');
lookupReference('요한복음 3:16');
// Works in Korean

setCanon(canon)

Set the default canon for all subsequent calls.

import { setCanon, lookupReference } from 'scripture-guide';

setCanon('lds');    // LDS Standard Works (default)
setCanon('rlds');   // RLDS/Community of Christ

Supported Reference Formats

FormatExample
Simple verseExodus 1:1
Chapter onlyGenesis 2
Verse rangeExodus 20:1-10
Split versesExodus 20:5,10
Split chaptersGenesis 1,3
Chapter rangeExodus 3-5
Multi-chapter rangeExodus 1:5-4:3
Multi-book rangeGenesis 30—Exodus 2
Compound referencesExodus 5:1; Leviticus 6:2
AbbreviationsMt 2:5, Mk 3, 1 Jn 1:5
Entire bookGenesis

Language Support

CodeLanguageExample Reference
enEnglishJohn 3:16
koKorean요한복음 3:16
deGermanJohannes 3:16
frFrenchJean 3:16
ruRussianИоанна 3:16
jpJapaneseヨハネによる福音書 3:16
vnVietnameseGiăng 3:16
trTurkishYuhanna 3:16
sweSwedishJohannes 3:16
tglTagalogJuan 3:16
slvSlovenianJanez 3:16
eoEsperantoJohano 3:16

Canons

CanonDescription
bibleProtestant Bible (66 books)
ldsLDS Standard Works (Bible + Book of Mormon + D&C + Pearl of Great Price)
rldsRLDS/Community of Christ canon
hinduHindu scriptures
buddhistBuddhist texts
islamIslamic texts

Verse IDs

Verse IDs are sequential integers starting from Genesis 1:1.

ReferenceVerse ID
Genesis 1:11
Genesis 1:22
Genesis 50:261533
Exodus 1:11534
Malachi 4:623145
Matthew 1:123146
John 3:1626137
Revelation 22:2131102

Use verse IDs to query your scripture database:

SELECT * FROM verses WHERE verse_id IN (26137, 26138, 26139);

Configuration

Custom Canon Data

Canon data is stored in data/canons/{canon}/{language}.yml:

canon: bible
language: en

books:
  genesis:
    name: Genesis
    pattern: "[Gg]enesis"
    alt: [Gen, Gn]
  exodus:
    name: Exodus
    pattern: "[Ee]xodus"
    alt: [Exod, Ex]

Structure Data

Verse counts per chapter are in data/structure/{canon}.yml:

genesis: [31, 25, 24, 26, 32, 22, 24, ...]  # verses per chapter
exodus: [22, 25, 22, 31, 23, 30, 25, ...]

Function Aliases

For convenience, functions have shorter aliases:

Full NameAliases
lookupReferencelookup, parse, read, ref2VerseId
generateReferencegenerate, gen, ref, verseId2Ref
detectReferencesdetect, detectRefs, linkRefs
setLanguagelang, setLang
setCanoncanon

Build

npm run build       # Build dist files
npm run test:jest   # Run tests

License

ISC

Author

KC Kern - kckern

Keywords

bible

FAQs

Package last updated on 14 Jan 2026

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