UNPKG

chapter-and-verse

Version:

Given a bible reference, validates it and returns an object with book, chapter, verse and more

13 lines (10 loc) 266 B
const errors = require('./errors') const getChapter = (cv, strChapter) => { const chapter = parseInt(strChapter) if (0 < chapter && chapter <= cv.book.chapters) { cv.chapter = chapter return cv } return errors.chapter } module.exports = getChapter