jota-parser

1.0.7 • Public • Published

Jota Parser finds references to Bible passages in the given text.

For example it will understand that "Read J 3 16" refers to the Gospel of John chapter 3 verse 16. Lots of examples of what it can parse are displayed here.

The output of parsing is an array of references, where reference can be a:

  1. Single chapter: [bookIndex, chapter]
  2. Single verse: [bookIndex, chapter, verse]
  3. Range of verses in a single chapter: [bookIndex, chapter, startVerse, endVerse]
  4. Chapter crossing range of verses: [[bookIndex1, chapter1, verse1?], [bookIndex2, chapter2, verse2?]]

Currently supported locales: en, pl. Locale bundles provide support for names of books in the given language.

Usage

ES6:

import { Parser, en } from 'jota-parser'
const parser = new Parser({ locales: [en] })
console.log(parser.parse('J 3 16'))

Browser:

<script type="module">
  import { Parser, en } from "https://unpkg.com/jota-parser?module"
  const parser = new Parser({locales: [en]})
  console.log(parser.parse('Read J 3:16'))
</script>

Development

Install the dependencies

npm install

Start the app in development mode (hot-code reloading, error reporting, etc.)

npm run dev

Build for production

It builds both library using vite.config.lib.js config and the github pages site using vite-config.gh-pages.js config

npm run build

Unit test

npm run test

Deploy github pages

npm run deploy:gh-pages

Add support for a new locale

  1. Create parser-${locale}.js in /src folder
  2. Create data-${locale}.js and parser.${locale}.spec.js in /test folder
  3. Add locale to supportedLocales constance in index.js

Readme

Keywords

none

Package Sidebar

Install

npm i jota-parser

Weekly Downloads

0

Version

1.0.7

License

BSD-3-Clause

Unpacked Size

20.7 kB

Total Files

4

Last publish

Collaborators

  • virtuecoder