aboutsummaryrefslogtreecommitdiff
path: root/internal/bible/bible.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/bible/bible.go')
-rw-r--r--internal/bible/bible.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/internal/bible/bible.go b/internal/bible/bible.go
index 0254ceb..312daeb 100644
--- a/internal/bible/bible.go
+++ b/internal/bible/bible.go
@@ -2,6 +2,7 @@ package bible
import (
"embed"
+ "sort"
"strconv"
"strings"
"sync"
@@ -58,3 +59,15 @@ func load(version string) *corpus {
func Verses(version, book string, chap int) []Verse {
return load(version).books[book][chap]
}
+
+// Chapters returns the chapter numbers present for a book in a version, sorted
+// ascending (empty if the version has no such book).
+func Chapters(version, book string) []int {
+ chapMap := load(version).books[book]
+ chaps := make([]int, 0, len(chapMap))
+ for ch := range chapMap {
+ chaps = append(chaps, ch)
+ }
+ sort.Ints(chaps)
+ return chaps
+}