is-valid-chapter-range.go (391B)
1 package utils 2 3 import ( 4 f "git.hanabi.in/gitbox/quran-go/src/fetch" 5 t "git.hanabi.in/gitbox/quran-go/src/types" 6 ) 7 8 // Check if the chapter number is valid. 9 func isValidChapRange(chapter t.Chap) (res bool, err error) { 10 11 if lastChapter, err := f.LastChapter(); err != nil { 12 return res, err 13 } else { 14 if 1 <= chapter && chapter <= lastChapter { 15 res = true 16 } 17 return res, err 18 } 19 20 }