2.1.0 • Published 6 years ago

bible-ref-tool v2.1.0

Weekly downloads
1
License
ISC
Repository
-
Last release
6 years ago

Bible Reference Parser

Reference ID Types

NameDescriptionExample
int1414 digit string of numbers00100100100001
osisOSIS style idMatt.1.1.
usxSimilar to OSIS but uses USX book codesGEN.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
2.1.0

6 years ago

2.0.0

6 years ago

1.0.1

6 years ago

1.0.0

7 years ago