You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For more information and documentation click [here](https://github.com/BibleJS/BibleApp).
17
17
18
-
##Methods
18
+
# Methods
19
19
20
-
### Constructor: `new Bible(options)`
21
-
Creates a new `Bible` instance.
20
+
##`new Bible(options)`
21
+
Creates a new `Bible` instance
22
22
23
-
#### Arguments
23
+
### Params
24
+
***Object***options* An object containing the following fields:
24
25
25
-
-`@options` object containing:
26
-
-`language`: the language (currently the supported languages are Romanian (`"RO"`) and English (`"EN"`)
26
+
-`language`: the langauge of the Bible instance
27
27
28
-
#### Example
28
+
## `myBible.get(reference, callback)`
29
+
This function gets a verse/chapter etc providing the `reference`
29
30
30
-
```js
31
-
var Bible =new (require ("bible.js"))({
32
-
language:"EN"
33
-
})
34
-
```
35
-
36
-
### `Bible.get (reference, callback)`
37
-
This function gets the verses/chapter represented by `@reference` argument. The `@callback` function is called with an error and an array of verses (objects).
38
-
39
-
#### Arguments
40
-
-`@reference`: a string in the following formats:
41
-
e.g. Genesis 1:1 - returns one verse
42
-
or Genesis 1:1,2 - returns two verses (1 and 2)
43
-
or Genesis 1:1-10 - returns the verses 1 - 10
44
-
or Genesis 1 - returns the whole chapter
31
+
### Params:
32
+
***String***reference* The verse reference. It can be in the following formats:
45
33
46
-
-`@callback`: the callback function
34
+
- Genesis 1:1 - returns one verse
35
+
- Genesis 1:1,2 - returns two verses (1 and 2)
36
+
- Genesis 1:1-10 - returns the verses 1 - 10
37
+
- Genesis 1 - returns the whole chapter
47
38
48
-
#### Example
39
+
***Function***callback* The callback function
49
40
50
-
```js
51
-
Bible.get("Psalm 1:1-6", function (err, data) {
52
-
/* do something */
53
-
});
54
-
```
41
+
### Return:
42
+
***Bible** The Bible instance (self)
55
43
56
-
### `Bible.search (query, callback)`
57
-
The method receives a string or a regular expression in the first argument (`@query`). The verses that match the query are fetched.
58
-
**NOTE**: right now only searching in json files is implemented.
59
-
60
-
#### Arguments
61
-
-`@query`: string or regular expression
62
-
-`@callback`: the callback function
63
-
64
-
#### Example
65
-
66
-
```js
67
-
Bible.search(/david/i, function (err, verses) {
68
-
/* do something with the verses that contain "david" */
69
-
});
70
-
```
44
+
## `search(query, callback)`
45
+
This function gets the verses that match to the regular expression
46
+
provided.
71
47
72
-
## Example
73
-
```js
74
-
// dependencies
75
-
var Bible =new (require ("bible.js"))({
76
-
language:"EN"
77
-
})
48
+
### Params:
49
+
***String|RegExp***query* The string/regular expression that matches the searched verses.
50
+
***Function***callback* The callback function
78
51
79
-
// the Bible reference
80
-
, reference ="Psalm 1:1-6"
81
-
;
52
+
### Return:
53
+
***Bible** The Bible instance (self)
82
54
83
-
// output
84
-
console.log(reference);
85
-
console.log("-------------");
55
+
## `init(config, callback)`
56
+
Inits BibleJS module by downloading versions set in configuration
57
+
This method should be called when the application is started.
86
58
87
-
// get verse
88
-
Bible.get(reference, function (err, data) {
59
+
### Params:
60
+
***Object***config* BibleJS configuration object. It must contain `versions` field as noted in documentation.
> bible.js@1.0.0 test /home/ionicabizau/Documents/BibleApp/node_modules/bible.js
134
+
> node test/index
135
+
136
+
Psalmi 1:1-6
137
+
-------------
138
+
1 | Ferice de omul care nu se duce la sfatul celor răi, nu se opreşte pe calea celor păcătoşi şi nu se aşază pe scaunul celor batjocoritori!
139
+
2 | Ci îşi găseşte plăcerea în Legea Domnului, şi zi şi noapte cugetă la Legea Lui!
140
+
3 | El este ca un pom sădit lângă un izvor de apă, care îşi dă rodul la vremea lui şi ale cărui frunze nu se veştejesc: tot ce începe, duce la bun sfârşit.
141
+
4 | Nu tot aşa este cu cei răi: ci ei sunt ca pleava pe care o spulberă vântul.
142
+
5 | De aceea cei răi nu pot ţine capul sus în ziua judecăţii, nici păcătoşii în adunarea celor neprihăniţi.
143
+
6 | Căci Domnul cunoaşte calea celor neprihăniţi, dar calea păcătoşilor duce la pieire.
144
+
-------------
145
+
146
+
-------------
147
+
23 | Blestemaţi pe Meroza, a zis Îngerul Domnului, blestemaţi, blestemaţi pe locuitorii lui; căci n-au venit în ajutorul Domnului, în ajutorul Domnului, printre oamenii viteji.
148
+
-------------
113
149
114
150
Psalm 1:1-6
115
151
-------------
@@ -122,37 +158,37 @@ Psalm 1:1-6
122
158
-------------
123
159
```
124
160
125
-
##Changelog
161
+
# Changelog
126
162
127
-
###`1.0.0`
163
+
## `1.0.0`
128
164
- First stable release with a lot of improvements
129
165
- Support custom language submodules (everyone can build one) via `git` and `npm`
130
166
131
-
###`v0.1.7`
167
+
## `v0.1.7`
132
168
- Added `search` method
133
169
- Removed `mongodb` as dependency
134
170
135
-
###`v0.1.6`
171
+
## `v0.1.6`
136
172
- Updated GitHub urls and email address
137
173
138
-
###`v0.1.5`
174
+
## `v0.1.5`
139
175
- Convert to uppercase the language field
140
176
141
-
###`v0.1.4`
177
+
## `v0.1.4`
142
178
- Get all verses from a chapter (bug when language is RO).
143
179
144
-
###`v0.1.3`
180
+
## `v0.1.3`
145
181
- Removed `_books` field.
146
182
- Use the new version of [Bible Data](https://github.com/BibleJS/Versions)
0 commit comments