node-sword-interface 1.0.22 → 1.0.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +19 -0
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -445,6 +445,25 @@ class NodeSwordInterface {
445
445
  return this.nativeInterface.getChapterVerseCount(moduleCode, bookCode, chapter);
446
446
  }
447
447
 
448
+ /**
449
+ * Returns the number verses in the given book.
450
+ *
451
+ * @param {String} moduleCode - The module code of the SWORD module.
452
+ * @param {String} bookCode - The book code of the SWORD module.
453
+ * @returns {Number} The verse count of the book.
454
+ */
455
+ getBookVerseCount(moduleCode, bookCode) {
456
+ const bookChapterCount = this.nativeInterface.getBookChapterCount(moduleCode, bookCode);
457
+ let verseCount = 0;
458
+
459
+ for (let i = 1; i <= bookChapterCount; i++) {
460
+ const chapterVerseCount = this.nativeInterface.getChapterVerseCount(moduleCode, bookCode, i);
461
+ verseCount += chapterVerseCount;
462
+ }
463
+
464
+ return verseCount;
465
+ }
466
+
448
467
  /**
449
468
  * Returns the Bible text of a module.
450
469
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-sword-interface",
3
- "version": "1.0.22",
3
+ "version": "1.0.23",
4
4
  "description": "Javascript (N-API) interface to SWORD library",
5
5
  "keywords": [
6
6
  "C++",