0.1.0 • Published 6 months ago
@biblionexus-foundation/scripture-utilities v0.1.0
scripture-utilities
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-utilitiesUsage
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.
- In this monorepo, publish the editor to
yalc, e.g.:nx devpub utilities - In the target application repo, link from
yalc:yalc link @biblionexus-foundation/scripture-utilities - In this monorepo, make changes and re-publish the editor (see step 1).
- When you have finished developing in the target application repo, unlink from
yalc:yalc remove @biblionexus-foundation/scripture-utilities && npm i