Function: collapseReferences()
collapseReferences(
verseIds,options?):string
Defined in: Services/ReferenceCollapser.ts:53
Collapse an array of verse IDs into a compact, human-readable reference string, similar to how TSK (Treasury of Scripture Knowledge) formats cross-references.
Consecutive verses within the same chapter are collapsed into ranges. References within the same book share the book name. Different books are separated by semicolons.
Parameters
verseIds
number[]
options?
Returns
string
Example
const ids = [44001002, 44001004, 44001005, 45002003, 45004005];
collapseReferences(ids);
// "Acts 1:2, 4-5; Romans 2:3, 4:5"
collapseReferences(ids, { format: 'short' });
// "Ac 1:2, 4-5; Ro 2:3, 4:5"
collapseReferences(ids, { format: 'medium' });
// "Acts 1:2, 4-5; Rom 2:3, 4:5"