1.0.7 • Published 5 months ago

jota-parser v1.0.7

Weekly downloads
-
License
BSD-3-Clause
Repository
github
Last release
5 months ago

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] 1. Single verse: [bookIndex, chapter, verse] 1. Range of verses in a single chapter: [bookIndex, chapter, startVerse, endVerse] 1. 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
1.0.7

5 months ago

1.0.6

5 months ago

1.0.5

5 months ago

1.0.4

9 months ago

1.0.3

10 months ago

1.0.2

10 months ago

1.0.1

10 months ago

1.0.0

11 months ago