The Bible as a NPM module.
# Using npm
npm install --save bible.js
# Using yarn
yarn add bible.js
const Bible = require("bible.js");
// Init Bible
Bible.init({
versions: {
en: {
source: "https://github.com/BibleJS/bible-english"
, version: "master"
, language: "en"
},
ro: {
source: "https://github.com/BibleJS/bible-romanian"
, version: "master"
, language: "ro"
}
}
}, err => {
if (err) { throw err; }
// Create Bible instances
const displayVerses = lang => {
return (err, data) => {
if (err) { throw err; }
console.log("-------------");
(data || []).forEach(c => {
console.log(c.verse + " | " + c.text);
})
console.log("-------------\n");
}
}
// Get a specific Bible verse in English
const enBible = new Bible({ language: "en" })
enBible.get("Psalm 1:1-6", displayVerses("en"));
// Get a specific Bible verse in Romanian
const roBible = new Bible({ language: "ro" })
roBible.get("Psalmii 1:1-6", displayVerses("ro"));
// Search
roBible.search("/meroza/gi", displayVerses("ro"));
});
There are few ways to get help:
- Please post questions on Stack Overflow. You can open issues with questions, as long you add a link to your Stack Overflow question.
- For bug reports and feature requests, open issues. 🐛
- For direct and quick help, you can use Codementor. 🚀
Inits BibleJS submodules by downloading them as set in the config
object
This method should be called before initializing the BibleJS instance.
- Object
config
: The configuration object containing the following field: versions
(Object)<version_name>
(Object)source
(String): The git url of the BibleJS submodule.version
(String): The git tag or branch of the submodule.language
(String): The submodule language.
- Function
cb
: The cb function.
- BibleJS The BibleJS constructor.
Creates a new BibleJS
instance.
- Object
options
: An object containing the following fields: language
: the langauge of the BibleJS instance (default:"en"
).
- BibleJS The
BibleJS
instance.
This function gets the response providing the BibleJS reference
.
- String
reference
: The verse reference. It can be in the following formats:
e.g. Genesis 1:1 - returns one verse
or Genesis 1:1,2 - returns two verses (1 and 2)
or Genesis 1:1-10 - returns the verses 1 - 10
or Genesis 1 - returns the whole chapter
- Function
cb
: The cb function.
- BibleJS The BibleJS instance (this).
This function gets the verses that match to the regular expression provided.
- String|RegExp
query
: The string/regular expression that matches the searched verses. - Function
cb
: The cb function
- BibleJS The BibleJS instance (this)
Have an idea? Found a bug? See how to contribute.
I open-source almost everything I can, and I try to reply to everyone needing help using these projects. Obviously, this takes time. You can integrate and use these projects in your applications for free! You can even change the source code and redistribute (even resell it).
However, if you get some profit from this or just want to encourage me to continue creating stuff, there are few ways you can do it:
-
Starring and sharing the projects you like 🚀
-
—I love books! I will remember you after years if you buy me one. 😁 📖
-
—You can make one-time donations via PayPal. I'll probably buy a
coffeetea. 🍵 -
—Set up a recurring monthly donation and you will get interesting news about what I'm doing (things that I don't share with everyone).
-
Bitcoin—You can send me bitcoins at this address (or scanning the code below):
1P9BRsmazNQcuyTxEqveUsnf5CERdq35V6
Thanks! ❤️
If you are using this library in one of your projects, add it in this list. ✨
bible-sample-config
bible