bible-ref-tool
v2.1.0
Published
## Reference ID Types
Downloads
2
Readme
Bible Reference Parser
Reference ID Types
| Name | Description | Example | | ----- | --------------------------------------- | -------------- | | int14 | 14 digit string of numbers | 00100100100001 | | osis | OSIS style id | Matt.1.1. | | usx | Similar to OSIS but uses USX book codes | GEN.1.1 |
Ranges
Any of these id types can be represented as a range using a -
between two ids.
Reference Object
book
is specified using USX book codes. All other fields are represnted as integers. A value of 0 for chapter, verse, segment or word means the value was not specified.
{
"isRange": true,
"start": {
"book": "MAT",
"chapter": 3,
"verse": 4,
"segment": 0,
"word": 7
},
"end": {
"book": "MAT",
"chapter": 3,
"verse": 4,
"segment": 0,
"word": 9
}
}
Usage
Parsing References
You can convert from one format to another as follows.
const ref = "00100100100004";
const fromFormat = "int14";
const toFormat = "usx";
BibleRefTool.convert(ref, fromFormat, toFormat); // GEN.1.1.4
A reference can also be parsed from a string into a reference object:
const ref = "00100100100004";
const format = "int14";
BibleRefTool.parse(ref, format);
Or a you can stringify an object into a reference format.
const refObj = {
isRange: true,
start: {
book: "MAT",
chapter: 3,
verse: 4,
segment: 0,
word: 7
},
end: {
book: "MAT",
chapter: 3,
verse: 4,
segment: 0,
word: 9
}
};
format = "usx";
BibleRefTool.stringify(refObj, format); // MAT.3.4.7