@hebcal/rest-api 4.5.0 → 4.5.2
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/dist/bundle.js +231 -248
- package/dist/bundle.min.js +2 -2
- package/dist/fullcalendar.js +4 -42
- package/dist/fullcalendar.min.js +2 -2
- package/dist/index.js +8 -45
- package/dist/index.mjs +8 -45
- package/package.json +15 -15
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @hebcal/rest-api v4.5.
|
|
1
|
+
/*! @hebcal/rest-api v4.5.2 */
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
var core = require('@hebcal/core');
|
|
@@ -120,9 +120,6 @@ function pad4(number) {
|
|
|
120
120
|
function toISOString(d) {
|
|
121
121
|
return pad4(d.getFullYear()) + '-' + pad2(d.getMonth() + 1) + '-' + pad2(d.getDate());
|
|
122
122
|
}
|
|
123
|
-
const flagToCategory = [[core.flags.MAJOR_FAST, 'holiday', 'major', 'fast'], [core.flags.CHANUKAH_CANDLES, 'holiday', 'major'], [core.flags.DAF_YOMI, 'dafyomi'], [core.flags.HEBREW_DATE, 'hebdate'], [core.flags.MINOR_FAST, 'holiday', 'fast'], [core.flags.MINOR_HOLIDAY, 'holiday', 'minor'], [core.flags.MISHNA_YOMI, 'mishnayomi'], [core.flags.NACH_YOMI, 'nachyomi'], [core.flags.YERUSHALMI_YOMI, 'yerushalmi'], [core.flags.MODERN_HOLIDAY, 'holiday', 'modern'], [core.flags.MOLAD, 'molad'], [core.flags.OMER_COUNT, 'omer'], [core.flags.PARSHA_HASHAVUA, 'parashat'],
|
|
124
|
-
// backwards-compat
|
|
125
|
-
[core.flags.ROSH_CHODESH, 'roshchodesh'], [core.flags.SHABBAT_MEVARCHIM, 'mevarchim'], [core.flags.SPECIAL_SHABBAT, 'holiday', 'shabbat'], [core.flags.USER_EVENT, 'user']];
|
|
126
123
|
|
|
127
124
|
/**
|
|
128
125
|
* Returns a category and subcategory name
|
|
@@ -131,45 +128,10 @@ const flagToCategory = [[core.flags.MAJOR_FAST, 'holiday', 'major', 'fast'], [co
|
|
|
131
128
|
*/
|
|
132
129
|
function getEventCategories(ev) {
|
|
133
130
|
const desc = ev.getDesc();
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
case 'Candle lighting':
|
|
137
|
-
return ['candles'];
|
|
138
|
-
// YOM_TOV_ENDS
|
|
139
|
-
case 'Havdalah':
|
|
140
|
-
return ['havdalah'];
|
|
141
|
-
// flags.MINOR_FAST or flags.MAJOR_FAST
|
|
142
|
-
case 'Fast begins':
|
|
143
|
-
case 'Fast ends':
|
|
144
|
-
return ['zmanim', 'fast'];
|
|
145
|
-
case 'Purim':
|
|
146
|
-
return ['holiday', 'major'];
|
|
147
|
-
}
|
|
148
|
-
if (ev.cholHaMoedDay) {
|
|
149
|
-
return ['holiday', 'major', 'cholhamoed'];
|
|
150
|
-
}
|
|
151
|
-
const mask = ev.getFlags();
|
|
152
|
-
for (let i = 0; i < flagToCategory.length; i++) {
|
|
153
|
-
const attrs = flagToCategory[i];
|
|
154
|
-
if (mask & attrs[0]) {
|
|
155
|
-
return attrs.slice(1);
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
// Don't depend on flags.MINOR_HOLIDAY always being set
|
|
159
|
-
switch (desc) {
|
|
160
|
-
case 'Lag BaOmer':
|
|
161
|
-
case 'Leil Selichot':
|
|
162
|
-
case 'Pesach Sheni':
|
|
163
|
-
case 'Erev Purim':
|
|
164
|
-
case 'Purim Katan':
|
|
165
|
-
case 'Shushan Purim':
|
|
166
|
-
case 'Tu B\'Av':
|
|
167
|
-
case 'Tu BiShvat':
|
|
168
|
-
case 'Rosh Hashana LaBehemot':
|
|
169
|
-
return ['holiday', 'minor'];
|
|
170
|
-
default:
|
|
171
|
-
return ['holiday', 'major'];
|
|
131
|
+
if (desc === 'Purim' || desc === 'Erev Purim') {
|
|
132
|
+
return ['holiday', 'major'];
|
|
172
133
|
}
|
|
134
|
+
return ev.getCategories();
|
|
173
135
|
}
|
|
174
136
|
|
|
175
137
|
/**
|
|
@@ -231,7 +193,8 @@ function getCalendarTitle(events, options) {
|
|
|
231
193
|
* @return {string}
|
|
232
194
|
*/
|
|
233
195
|
function getHolidayDescription(ev, firstSentence = false) {
|
|
234
|
-
const
|
|
196
|
+
const str0 = holidayDescription[ev.getDesc()] || holidayDescription[ev.basename()] || '';
|
|
197
|
+
const str = str0.normalize();
|
|
235
198
|
if (firstSentence && str) {
|
|
236
199
|
const dot = str.indexOf('.');
|
|
237
200
|
if (dot != -1) {
|
|
@@ -590,8 +553,8 @@ function eventToClassicApiObject(ev, options, leyning$1 = true) {
|
|
|
590
553
|
};
|
|
591
554
|
}
|
|
592
555
|
const memo = ev.memo || holidayDescription[ev.basename()];
|
|
593
|
-
if (memo) {
|
|
594
|
-
result.memo = memo;
|
|
556
|
+
if (typeof memo === 'string' && memo.length !== 0) {
|
|
557
|
+
result.memo = memo.normalize();
|
|
595
558
|
} else if (typeof ev.linkedEvent !== 'undefined') {
|
|
596
559
|
result.memo = ev.linkedEvent.render(options.locale);
|
|
597
560
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @hebcal/rest-api v4.5.
|
|
1
|
+
/*! @hebcal/rest-api v4.5.2 */
|
|
2
2
|
import { flags, HDate, HebrewCalendar, Zmanim, Locale, gematriya } from '@hebcal/core';
|
|
3
3
|
import { getLeyningForParshaHaShavua, getLeyningForHoliday, formatAliyahWithBook } from '@hebcal/leyning';
|
|
4
4
|
import { getTriennialForParshaHaShavua } from '@hebcal/triennial';
|
|
@@ -118,9 +118,6 @@ function pad4(number) {
|
|
|
118
118
|
function toISOString(d) {
|
|
119
119
|
return pad4(d.getFullYear()) + '-' + pad2(d.getMonth() + 1) + '-' + pad2(d.getDate());
|
|
120
120
|
}
|
|
121
|
-
const flagToCategory = [[flags.MAJOR_FAST, 'holiday', 'major', 'fast'], [flags.CHANUKAH_CANDLES, 'holiday', 'major'], [flags.DAF_YOMI, 'dafyomi'], [flags.HEBREW_DATE, 'hebdate'], [flags.MINOR_FAST, 'holiday', 'fast'], [flags.MINOR_HOLIDAY, 'holiday', 'minor'], [flags.MISHNA_YOMI, 'mishnayomi'], [flags.NACH_YOMI, 'nachyomi'], [flags.YERUSHALMI_YOMI, 'yerushalmi'], [flags.MODERN_HOLIDAY, 'holiday', 'modern'], [flags.MOLAD, 'molad'], [flags.OMER_COUNT, 'omer'], [flags.PARSHA_HASHAVUA, 'parashat'],
|
|
122
|
-
// backwards-compat
|
|
123
|
-
[flags.ROSH_CHODESH, 'roshchodesh'], [flags.SHABBAT_MEVARCHIM, 'mevarchim'], [flags.SPECIAL_SHABBAT, 'holiday', 'shabbat'], [flags.USER_EVENT, 'user']];
|
|
124
121
|
|
|
125
122
|
/**
|
|
126
123
|
* Returns a category and subcategory name
|
|
@@ -129,45 +126,10 @@ const flagToCategory = [[flags.MAJOR_FAST, 'holiday', 'major', 'fast'], [flags.C
|
|
|
129
126
|
*/
|
|
130
127
|
function getEventCategories(ev) {
|
|
131
128
|
const desc = ev.getDesc();
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
case 'Candle lighting':
|
|
135
|
-
return ['candles'];
|
|
136
|
-
// YOM_TOV_ENDS
|
|
137
|
-
case 'Havdalah':
|
|
138
|
-
return ['havdalah'];
|
|
139
|
-
// flags.MINOR_FAST or flags.MAJOR_FAST
|
|
140
|
-
case 'Fast begins':
|
|
141
|
-
case 'Fast ends':
|
|
142
|
-
return ['zmanim', 'fast'];
|
|
143
|
-
case 'Purim':
|
|
144
|
-
return ['holiday', 'major'];
|
|
145
|
-
}
|
|
146
|
-
if (ev.cholHaMoedDay) {
|
|
147
|
-
return ['holiday', 'major', 'cholhamoed'];
|
|
148
|
-
}
|
|
149
|
-
const mask = ev.getFlags();
|
|
150
|
-
for (let i = 0; i < flagToCategory.length; i++) {
|
|
151
|
-
const attrs = flagToCategory[i];
|
|
152
|
-
if (mask & attrs[0]) {
|
|
153
|
-
return attrs.slice(1);
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
// Don't depend on flags.MINOR_HOLIDAY always being set
|
|
157
|
-
switch (desc) {
|
|
158
|
-
case 'Lag BaOmer':
|
|
159
|
-
case 'Leil Selichot':
|
|
160
|
-
case 'Pesach Sheni':
|
|
161
|
-
case 'Erev Purim':
|
|
162
|
-
case 'Purim Katan':
|
|
163
|
-
case 'Shushan Purim':
|
|
164
|
-
case 'Tu B\'Av':
|
|
165
|
-
case 'Tu BiShvat':
|
|
166
|
-
case 'Rosh Hashana LaBehemot':
|
|
167
|
-
return ['holiday', 'minor'];
|
|
168
|
-
default:
|
|
169
|
-
return ['holiday', 'major'];
|
|
129
|
+
if (desc === 'Purim' || desc === 'Erev Purim') {
|
|
130
|
+
return ['holiday', 'major'];
|
|
170
131
|
}
|
|
132
|
+
return ev.getCategories();
|
|
171
133
|
}
|
|
172
134
|
|
|
173
135
|
/**
|
|
@@ -229,7 +191,8 @@ function getCalendarTitle(events, options) {
|
|
|
229
191
|
* @return {string}
|
|
230
192
|
*/
|
|
231
193
|
function getHolidayDescription(ev, firstSentence = false) {
|
|
232
|
-
const
|
|
194
|
+
const str0 = holidayDescription[ev.getDesc()] || holidayDescription[ev.basename()] || '';
|
|
195
|
+
const str = str0.normalize();
|
|
233
196
|
if (firstSentence && str) {
|
|
234
197
|
const dot = str.indexOf('.');
|
|
235
198
|
if (dot != -1) {
|
|
@@ -588,8 +551,8 @@ function eventToClassicApiObject(ev, options, leyning = true) {
|
|
|
588
551
|
};
|
|
589
552
|
}
|
|
590
553
|
const memo = ev.memo || holidayDescription[ev.basename()];
|
|
591
|
-
if (memo) {
|
|
592
|
-
result.memo = memo;
|
|
554
|
+
if (typeof memo === 'string' && memo.length !== 0) {
|
|
555
|
+
result.memo = memo.normalize();
|
|
593
556
|
} else if (typeof ev.linkedEvent !== 'undefined') {
|
|
594
557
|
result.memo = ev.linkedEvent.render(options.locale);
|
|
595
558
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hebcal/rest-api",
|
|
3
|
-
"version": "4.5.
|
|
3
|
+
"version": "4.5.2",
|
|
4
4
|
"author": "Michael J. Radwin (https://github.com/mjradwin)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"hebcal"
|
|
@@ -28,9 +28,9 @@
|
|
|
28
28
|
"url": "https://github.com/hebcal/hebcal-rest-api/issues"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@hebcal/core": "^4.
|
|
32
|
-
"@hebcal/leyning": "^7.3
|
|
33
|
-
"@hebcal/triennial": "^1.2
|
|
31
|
+
"@hebcal/core": "^4.3.1",
|
|
32
|
+
"@hebcal/leyning": "^7.4.3",
|
|
33
|
+
"@hebcal/triennial": "^1.3.2"
|
|
34
34
|
},
|
|
35
35
|
"scripts": {
|
|
36
36
|
"build": "rollup -c",
|
|
@@ -46,21 +46,21 @@
|
|
|
46
46
|
]
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@babel/core": "^7.
|
|
50
|
-
"@babel/preset-env": "^7.
|
|
51
|
-
"@babel/register": "^7.
|
|
52
|
-
"@hebcal/learning": "^1.1
|
|
49
|
+
"@babel/core": "^7.22.11",
|
|
50
|
+
"@babel/preset-env": "^7.22.10",
|
|
51
|
+
"@babel/register": "^7.22.5",
|
|
52
|
+
"@hebcal/learning": "^1.5.1",
|
|
53
53
|
"@rollup/plugin-babel": "^6.0.3",
|
|
54
|
-
"@rollup/plugin-commonjs": "^
|
|
54
|
+
"@rollup/plugin-commonjs": "^25.0.4",
|
|
55
55
|
"@rollup/plugin-json": "^6.0.0",
|
|
56
|
-
"@rollup/plugin-node-resolve": "^15.
|
|
57
|
-
"@rollup/plugin-terser": "^0.4.
|
|
58
|
-
"ava": "^5.
|
|
59
|
-
"core-js": "^3.
|
|
60
|
-
"eslint": "^8.
|
|
56
|
+
"@rollup/plugin-node-resolve": "^15.2.1",
|
|
57
|
+
"@rollup/plugin-terser": "^0.4.3",
|
|
58
|
+
"ava": "^5.3.1",
|
|
59
|
+
"core-js": "^3.32.1",
|
|
60
|
+
"eslint": "^8.48.0",
|
|
61
61
|
"eslint-config-google": "^0.14.0",
|
|
62
62
|
"jsdoc": "^4.0.2",
|
|
63
63
|
"jsdoc-to-markdown": "^8.0.0",
|
|
64
|
-
"rollup": "^3.
|
|
64
|
+
"rollup": "^3.28.1"
|
|
65
65
|
}
|
|
66
66
|
}
|