https://github.com/unfoldingword/bible-reference-range
Library for Parsing Bible References
https://github.com/unfoldingword/bible-reference-range
scripture-open-components
Last synced: 3 months ago
JSON representation
Library for Parsing Bible References
- Host: GitHub
- URL: https://github.com/unfoldingword/bible-reference-range
- Owner: unfoldingWord
- License: mit
- Created: 2022-07-20T12:44:40.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-12-07T19:15:38.000Z (over 1 year ago)
- Last Synced: 2024-04-13T16:08:17.344Z (about 1 year ago)
- Topics: scripture-open-components
- Language: JavaScript
- Homepage:
- Size: 163 KB
- Stars: 1
- Watchers: 5
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# bible-reference-range
[](https://github.com/unfoldingWord/bible-reference-range/actions)
[](https://github.com/unfoldingWord/bible-reference-range/tags)
[](https://www.npmjs.com/package/bible-reference-range)
[](https://coveralls.io/github/unfoldingWord/bible-reference-range?branch=main)A Library for handling bible reference ranges.
### API
These are the exposed end-points
- parseReferenceToList
- Takes a reference and splits into individual verses or verse spans. Can handle reference in format such as: “2:4-5”, “2:3a”, “2-3b-4a”, “2:7,12”, “7:11-8:2”, "6:15-16;7:2". It returns a list of {chapter, verse}. Or in the case of a verse range it returns {chapter, verse, endChapter, endVerse}.
- getVerses
- finds all verses from a bible contained in ref, returning an array of {chapter, verse, verseData}
- cleanupReference
- takes a reference and splits into individual verses or verse spans for cleanup. Then recombines the cleaned up references to a string. Primarily it removes extra characters following the verse number (as in the case of `2:4b-5a`) to make it easier to iterate through the verses.
- referenceHelpers
- contains all the lower level methods to allow external use.
- doesReferenceContain
- Takes two references and determines if a reference is contained within another reference.### INSTALL
- npm users : `nmp i`
- yarn users : `yarn`### USING
- In your code add import:
`import { parseReferenceToList, cleanupReference } from 'bible-reference-range';`
- or to use all the exports do:
`import { referenceHelpers } from 'bible-reference-range';`