2.2.2 โข Published 7 months ago
@allemandi/bible-validate v2.2.2
๐ @allemandi/bible-validate
Utilities for validating and parsing Bible references
Supports ESM, CommonJS, UMD, and TypeScript โ works in modern builds, Node.js, and browsers.
๐ Table of Contents
โจ Features
- Validate Bible book names and aliases
- Get chapter and verse counts
- Normalize references (e.g.
"III John Chapter 1 verses 3 - 8"to"3 John 1:3-8") - Validate full references (book, chapter, verse range)
- Parse and format Bible references with optional structured output
๐ ๏ธ Installation
# Yarn
yarn add @allemandi/bible-validate
# or NPM
npm install @allemandi/bible-validate๐ Quick Usage Examples
๐ For a complete list of methods and options, see the API docs.
ESM
import {
parseAndValidateReference,
isValidBook,
getChapterCount,
} from '@allemandi/bible-validate';
const ref = 'GeN Chapter 3: 16 to 18';
const result = parseAndValidateReference(ref, {structured: true})
console.log(result);
// {
// isValid: true,
// book: 'Genesis',
// chapter: 3,
// verseStart: 16,
// verseEnd: 18,
// formatted: 'Genesis 3:16-18',
// error: null,
// original: 'GeN Chapter 3: 16 to 18'
// }
// Check book validity
console.log(isValidBook('Second Chronicles')); // true
// Get verse count for specific chapter in a book
console.log(getVerseCount('Rev', 3)) // 22CommonJS
const { parseAndValidateReference } = require('@allemandi/bible-validate');UMD (Browser)
<script src="https://unpkg.com/@allemandi/bible-validate"></script>
<script>
const result = window.bibleValidate.parseAndValidateReference('John 3:16');
console.log(result);
</script>๐งช Tests
Available in the GitHub repo only.
# Run the test suite with Jest
yarn test
# or
npm test๐ค Contributing
If you have ideas, improvements, or new features:
- Fork the project
- Create your feature branch (git checkout -b feature/amazing-feature)
- Commit your changes (git commit -m 'Add some amazing feature')
- Push to the branch (git push origin feature/amazing-feature)
- Open a Pull Request