rosario 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +21 -0
- package/index.d.ts +21 -0
- package/index.js +51 -0
- package/package.json +31 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Georges Kmeid
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# rosario
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install atgeo
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
import rosario from "rosario";
|
|
15
|
+
|
|
16
|
+
const r = rosario({ mystery: "joyful" });
|
|
17
|
+
|
|
18
|
+
console.log(r.current());
|
|
19
|
+
|
|
20
|
+
r.next();
|
|
21
|
+
```
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export type Mystery =
|
|
2
|
+
| 'joyful'
|
|
3
|
+
| 'sorrowful'
|
|
4
|
+
| 'glorious'
|
|
5
|
+
| 'luminous'
|
|
6
|
+
|
|
7
|
+
export interface RosarioOptions {
|
|
8
|
+
mystery?: Mystery
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface RosarioSession {
|
|
12
|
+
next(): void
|
|
13
|
+
|
|
14
|
+
current(): string
|
|
15
|
+
|
|
16
|
+
done(): boolean
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export default function rosario(
|
|
20
|
+
options?: RosarioOptions
|
|
21
|
+
): RosarioSession
|
package/index.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { MYSTERIES } from './mysteries.js'
|
|
2
|
+
import { PRAYERS } from './prayers.js'
|
|
3
|
+
|
|
4
|
+
const DECADE = [
|
|
5
|
+
'ourFather',
|
|
6
|
+
...Array(10).fill('hailMary'),
|
|
7
|
+
'gloryBe',
|
|
8
|
+
'fatimaPrayer',
|
|
9
|
+
]
|
|
10
|
+
|
|
11
|
+
function buildOrder (mystery) {
|
|
12
|
+
const events = MYSTERIES[mystery]
|
|
13
|
+
if (!events) throw new Error('Unknown mystery')
|
|
14
|
+
|
|
15
|
+
return [
|
|
16
|
+
'apostlesCreed',
|
|
17
|
+
'ourFather',
|
|
18
|
+
'hailMary',
|
|
19
|
+
'hailMary',
|
|
20
|
+
'hailMary',
|
|
21
|
+
'gloryBe',
|
|
22
|
+
...events.flatMap(event => DECADE),
|
|
23
|
+
]
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export default function rosario ({ mystery = 'joyful' } = {}) {
|
|
27
|
+
const order = buildOrder(mystery)
|
|
28
|
+
let index = 0
|
|
29
|
+
|
|
30
|
+
return {
|
|
31
|
+
next() {
|
|
32
|
+
if (index < order.length - 1) index++
|
|
33
|
+
},
|
|
34
|
+
|
|
35
|
+
current() {
|
|
36
|
+
const key = order[index]
|
|
37
|
+
return {
|
|
38
|
+
prayer: key,
|
|
39
|
+
text: PRAYERS[key]
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
|
|
43
|
+
done() {
|
|
44
|
+
return index >= order.length - 1
|
|
45
|
+
},
|
|
46
|
+
|
|
47
|
+
reset() {
|
|
48
|
+
index = 0
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "rosario",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "A tiny Catholic rosary prayer engine for web apps",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"rosary",
|
|
7
|
+
"rosario",
|
|
8
|
+
"catholic"
|
|
9
|
+
],
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "git+https://github.com/atgeo/rosario.git"
|
|
14
|
+
},
|
|
15
|
+
"author": "Georges Kmeid <georgesk117@gmail.com>",
|
|
16
|
+
"main": "index.js",
|
|
17
|
+
"type": "module",
|
|
18
|
+
"sideEffects": false,
|
|
19
|
+
"exports": {
|
|
20
|
+
".": "./index.js"
|
|
21
|
+
},
|
|
22
|
+
"types": "index.d.ts",
|
|
23
|
+
"files": [
|
|
24
|
+
"LICENSE",
|
|
25
|
+
"index.js",
|
|
26
|
+
"index.d.ts"
|
|
27
|
+
],
|
|
28
|
+
"scripts": {
|
|
29
|
+
"test": "node --test"
|
|
30
|
+
}
|
|
31
|
+
}
|