Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bible-api

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bible-api - npm Package Compare versions

Comparing version 1.0.3 to 1.0.4

config.js

58

index.js

@@ -1,7 +0,57 @@

const example = require('./js/example')
const config = require('./config')
const getVersions = require('./js/helpers/get-versions')
const doSearchRequests = require('./js/http/search/do-search-requests')
const doVerseRequests = require('./js/http/verse/do-verse-requests')
const urlSearchBuilder = require('./js/http/search/url-search-builder')
const urlVerseBuilder = require('./js/http/verse/url-verse-builder')
const errors = require('./errors')
const main = () => {
return example()
class BibleApi {
constructor() {
this.defaultVersions = getVersions()
this.resultsPerPage = 50
}
checkApiKey() {
if (this.apiKey == null) throw errors.generic.apiKey()
}
getVersions() {
return config.publicVersions
}
setApiKey(apiKey) {
if (typeof apiKey !== 'string') throw errors.type.apiKey()
this.apiKey = apiKey.trim()
}
setDefaultVersions(versions) {
this.defaultVersions = getVersions(versions, this.defaultVersions)
}
setNumberOfSearchResultsPerPage(resultsPerPage) {
if (!Number.isInteger(resultsPerPage) || resultsPerPage < 1) throw errors.type.resultsPerPage()
this.resultsPerPage = resultsPerPage
}
getReference(reference, versions) {
if (typeof reference !== 'string') throw errors.type.reference()
this.checkApiKey()
versions = getVersions(versions, this.defaultVersions)
const urls = urlVerseBuilder(this.apiKey, versions, reference)
if (urls == null) throw errors.generic.reference(reference)
return doVerseRequests(urls, versions, reference)
}
search(query, versions, offset = 0) {
if (typeof query !== 'string') throw errors.type.query()
if (!Number.isInteger(offset) || offset < 0) throw errors.type.offset()
this.checkApiKey()
versions = getVersions(versions, this.defaultVersions)
const urls = urlSearchBuilder(this.apiKey, versions, query, offset, this.resultsPerPage)
return doSearchRequests(urls, versions)
}
}
module.exports = main
module.exports = new BibleApi()

18

package.json
{
"name": "bible-api",
"version": "1.0.3",
"version": "1.0.4",
"description": "Bible API that relies on the Digital Bible Toolkit at www.digitalbibleplatform.com",

@@ -12,7 +12,10 @@ "author": "danday74",

"build": "npm-run-all test enforcer",
"prepush": "npm test"
"prepush": "npm run build"
},
"dependencies": {
"chapter-and-verse": "^1.0.6",
"lodash": "^4.17.5"
"axios": "^0.17.1",
"chapter-and-verse": "^2.0.2",
"lodash": "^4.17.5",
"type-check": "^0.3.2",
"url": "^0.11.0"
},

@@ -25,4 +28,7 @@ "devDependencies": {

"istanbul": "^0.4.5",
"mocha": "^5.0.0",
"npm-run-all": "^4.1.2"
"mocha": "^5.0.1",
"nock": "^9.1.6",
"npm-run-all": "^4.1.2",
"prettyjson": "^1.2.1",
"sinon": "^4.3.0"
},

@@ -29,0 +35,0 @@ "keywords": [],

@@ -17,2 +17,4 @@ # bible-api

TODO .. Development in progress, docs coming real soon
TODO .. Development in progress, this may take some time!

@@ -0,1 +1,2 @@

// process.env.DEBUG = 'nock.*'
process.env.NODE_ENV = 'test'

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc