@biblionexus-foundation/scripture-utilities
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

scripture-utilities

Build Status CodeQL Github Tag

Utilities for working with Scripture data.

Features

For data that conforms to USX/USJ v3.1:

  • USJ to USX converter.
  • USX to USJ converter.

Install

npm install @biblionexus-foundation/scripture-utilities

Usage

import { usxStringToUsj, usjToUsxString } from "@biblionexus-foundation/scripture-utilities";

const emptyUsx = '<usx version="3.1" />';
const usx = `
<?xml version="1.0" encoding="utf-8"?>
<usx version="3.1">
  <book code="PSA" style="id">World English Bible (WEB)</book>
  <para style="mt1">The Psalms</para>
  <chapter number="1" style="c" sid="PSA 1" />
  <para style="q1">
    <verse number="1" style="v" sid="PSA 1:1" />Blessed is the man who doesn’t walk in the counsel of the wicked,</para>
  <para style="q2" vid="PSA 1:1">nor stand on the path of sinners,</para>
  <para style="q2" vid="PSA 1:1">nor sit in the seat of scoffers;<verse eid="PSA 1:1" /></para>
</usx>
`;

const emptyUsj = usxStringToUsj(emptyUsx);
const usj = usxStringToUsj(usx);

const newUsx = usjToUsxString(usj);

Building

Run nx build utilities to build the library.

Running unit tests

Run nx test utilities to execute the unit tests via Jest.

Develop in App

To develop these utilities in a target application you can use yalc to link the editor in without having to publish to NPM every time something changes.

  1. In this monorepo, publish the editor to yalc, e.g.:
    nx devpub utilities
  2. In the target application repo, link from yalc:
    yalc link @biblionexus-foundation/scripture-utilities
  3. In this monorepo, make changes and re-publish the editor (see step 1).
  4. When you have finished developing in the target application repo, unlink from yalc:
    yalc remove @biblionexus-foundation/scripture-utilities && npm i

License

MIT © BiblioNexus Foundation

Readme

Keywords

none

Package Sidebar

Install

npm i @biblionexus-foundation/scripture-utilities

Weekly Downloads

159

Version

0.1.0

License

MIT

Unpacked Size

72.2 kB

Total Files

19

Last publish

Collaborators

  • biblionexus
  • irahop
  • samueljd