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 🙏

© 2026 – Pkg Stats / Ryan Hefner

swordjs

v0.1.7

Published

swordjs - access modules from crosswire.org/sword in JS

Downloads

42

Readme

sword.js

sword.js is a pure Javascript library to read the bible modules from Crosswire. It currently supports only compressed (zText) bible modules. BibleZ NG is based on this library.

Build

Install webpack an run npm run build. For development use npm start and open http://localhost:8080/webpack-dev-server/ in your browser.

Usage

npm install swordjs then you can require it.

API

sword.js is currently in a alpha version, so the API will likely change in the future.

Most API calls take a callback as the last argument. The callback will return null or an error as first argument. The second, third, ... argument is the reponse from the API.

installMgr

installMgr.getRepositories(inCallback)

Get a list of all available repositories and takes a callback funtion as argument. The callback will return an array of the repositories as second argument (first will be null or an error). Currently only the following CrossWire repos are supported:

  • main
  • beta
  • av11n
  • attic
  • Wycliffe
  • av11n attic

installMgr.getRemoteModules(inRepo, inUrl, inCallback)

Get a list of all modules in a repository. inRepo is an object containing the repository url and the repository type. inUrl is optional. The callback will return an array with all modules.

installMgr.installModule(inUrl, inCallback, inProgressCallback)

This will install a module from inUrl. You can also pass a file blob from a zipped module file for offline installation as first argument. The callback will return null or an error as the first argument. The second callback is optional. It will report the progress of the module download.

installMgr.removeModule(iModuleKey, inCallback)

This will remove the module with the inModuleKey. The callback will return null or an error as the first argument.

moduleMgr

####moduleMgr.getModules(inCallback) #### This will return a list of all installed modules.

Module

Each module has the following properties and API:

config

This property contains the all the module information that is normally found in a modules *.conf file.

renderText(inPassage, inOptions, inCallback)

inPassage is a passage in a bible like Gen 1 or Romans 3. inOptions is an Object and optional. It can contain the following porperties (default values):

{
    oneVersePerLine: false,
    footnotes: false,
    crossReferences: false,
    headings: false,
    wordsOfChristInRed: false,
    intro: false, //show book or chapter introductions
}

The callback will return an object as second argument:

Example:

{
    text: "...", //the rendered text (HTML),
    footnotes: {
        "Gen.1.1": [{note: "/*Note text*/", n: "1"}, {...}],
        "Gen.1.4": [{note: "/*Note text*/", n: "2"}, {...}],
        ...
    }
}

getAllBooks(inCallback)

Returns a list of all books in a module.

###verseKey###

verseKey.parse(inPassage, inV11n)

Takes a passage (e.g. Matt 1:1) as argument an returns an object like this:

{
    osisRef: "Matt.1.1",
    book: "Matt",
    bookNum: 39,
    chapter: 1
    verse: 1 //this can also be NaN if you pass a passage the has no verse in it like "Matt 1".
}

verseKey.next(inPassage, inV11n)

Returns the next chapter that follows inPassage. If you pass "Matt 1" you will get an verseKey object for "Matt 2".

verseKey.previous(inPassage, inV11n)

Returns the previous chapter that comes before inPassage. If you pass "Mark 1" you will get an verseKey object for "Matt 28".

Licence

sword.js is licenced under the GNU GPLv3.