npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

versification

v0.0.24

Published

A library for parsing Paratext's vrs files.

Downloads

32

Readme

versification

A library for parsing Paratext's vrs files.

license builds.sr.ht status

Installation

npm install --save versification

Usage

The library has two main classes Versification and VerseRef. Versification parses a Paratext versification file (.vrs), which can be used to convert a VerseRef from one versification to another.


// Example usage, creating a VerseRef with Versification.

import Versification, { VerseRef } from 'versification';

const testVersification = `
# Versification  "English"
GEN 1:31 2:25 3:24 4:26 5:32 6:22
PSA 1:6 2:12 3:8
PSA 3:0-8 = PSA 3:1-9
`;


const myReducedSizeEnglishVersification = new Versification(testVersification);

const myVerseRef = VerseRef.parse('PSA 3:1', myReducedSizeEnglishVersification);

// Example changing a VerseRef versification.

import Versification, { VerseRef } from 'versification';

const testEnglishVersification = `
# Versification  "English"
GEN 1:31 2:25 3:24 4:26 5:32 6:22
PSA 1:6 2:12 3:8
PSA 3:0-8 = PSA 3:1-9
`;

const testOriginalVersification = `
# Versification  "Original"
GEN 1:31 2:25 3:24 4:26 5:32 6:22
PSA 1:6 2:12 3:9
`;

const engV = new Versification(testEnglishVersification);
const orgV = new Versification(testOriginalVersification);

const myEnglishVerseRef = VerseRef.parse('PSA 3:1', engV);

const myOriginalVerseRef = orgV.changeVersification(myEnglishVerseRef);

// Outputs 'PSA 3:2'
console.log(myOriginalVerseRef.toString()); 

Versification

|method | description | return type | |------ |------------ | ----------- | | constructor(string) | Create Versification from vrs file contents | | | static nameToFileName(string) | Helper function to map versification name to Paratext vrs file name. EG "original" -> "org" | string | | static bookIdToNumber(string) | Helper function to convert a book id to its index number. EG "GEN" => 1 | number | | books | Returns 1 based array showing verses per chapter. eg. indexing result with [1][2] would return then number of verses in GEN 2. | number[][] | | mappings | Returns versification specific mappings. First VerseRef [0] is from, second [1] is to. | [VerseRef,VerseRef][] | | excludedVerses(book? number, chapter? number) | return number is bbbcccvvv. Optionally filter results by book + chapter number. | Set<number> | | verseSegments(book? number, chapter? number | number is bbbcccvvv. Optionally filter results by book + chapter number. | Record<number, string[]> | | changeVersification(VerseRef) | Convert a VerseRef to this versification. (applying any mappings) | VerseRef | | equals(Versification) | Compare Versification (by name) | boolean |

VerseRef

|method | description | return type | |------ |------------ | ----------- | | static parse(string, ?Versification) | Create a VerseRef from a verse ref string and optional versification| VerseRef | | static fromBookIdChapterVerse(string, number, number, ?Versification) | Create a verseRef from Book Id (eg. 'GEN') and chapter and verse numbers, and optional versification.| VerseRef | | static fromBookChapterVerse(number, number, number, ?Versification) | Create a verseRef from book, chapter and verse numbers, and optional versification.| VerseRef | | static frombcv(number or string, ?Versification) | Create a verseRef from a bbbcccvvv and optional versification.| VerseRef | | static toBook(number bbbcccvvv) | extract book number from bbbcccvvv | number | static toChapter(number bbbcccvvv) | extract chapter number from bbbcccvvv | number | static toVerse(number bbbcccvvv) | extract verse number from bbbcccvvv | number | book | Returns book ID | string | | chapter | Returns chapter number as string | string | | verse | Returns verse as string. (can be a verse range or a split verse)| string | | verseNum | Returns verse as number. (if range will be the first verse in range)| number | | verseNumEnd | undefined if VerseRef is not a range.| number or undefined | | segment | undefined if VerseRef is not a split verse.| string or undefined | | versification | Return the Versification for this VerseRef. If not specified will return undefined. | Versification or undefined | | changeVersification(Versification) | Update this VerseRef to new versification. (applying any mappings)| | | bbbcccvvv | A number encoded with book, chapter + verse. | number | | equals(VerseRef) | Compare Verse ref | boolean | | isDefinedByVersification | returns true if verseRef is defined by its versification or versification not defined. | boolean | | toString | Returns a verse ref string | string |