jcal-zmanim 1.2.0 → 1.2.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.
Files changed (59) hide show
  1. package/LICENSE +674 -674
  2. package/dist/README.md +596 -566
  3. package/dist/index.cjs +13325 -0
  4. package/dist/index.cjs.map +1 -0
  5. package/dist/index.d.cts +922 -0
  6. package/dist/index.d.ts +922 -2
  7. package/dist/index.js +3564 -35
  8. package/dist/index.js.map +1 -1
  9. package/package.json +48 -46
  10. package/dist/JCal/Dafyomi.d.ts +0 -28
  11. package/dist/JCal/Dafyomi.d.ts.map +0 -1
  12. package/dist/JCal/Dafyomi.js +0 -130
  13. package/dist/JCal/Dafyomi.js.map +0 -1
  14. package/dist/JCal/Location.d.ts +0 -33
  15. package/dist/JCal/Location.d.ts.map +0 -1
  16. package/dist/JCal/Location.js +0 -77
  17. package/dist/JCal/Location.js.map +0 -1
  18. package/dist/JCal/Molad.d.ts +0 -38
  19. package/dist/JCal/Molad.d.ts.map +0 -1
  20. package/dist/JCal/Molad.js +0 -90
  21. package/dist/JCal/Molad.js.map +0 -1
  22. package/dist/JCal/PirkeiAvos.d.ts +0 -14
  23. package/dist/JCal/PirkeiAvos.d.ts.map +0 -1
  24. package/dist/JCal/PirkeiAvos.js +0 -171
  25. package/dist/JCal/PirkeiAvos.js.map +0 -1
  26. package/dist/JCal/Sedra.d.ts +0 -64
  27. package/dist/JCal/Sedra.d.ts.map +0 -1
  28. package/dist/JCal/Sedra.js +0 -183
  29. package/dist/JCal/Sedra.js.map +0 -1
  30. package/dist/JCal/Zmanim.d.ts +0 -96
  31. package/dist/JCal/Zmanim.d.ts.map +0 -1
  32. package/dist/JCal/Zmanim.js +0 -223
  33. package/dist/JCal/Zmanim.js.map +0 -1
  34. package/dist/JCal/ZmanimUtils.d.ts +0 -72
  35. package/dist/JCal/ZmanimUtils.d.ts.map +0 -1
  36. package/dist/JCal/ZmanimUtils.js +0 -349
  37. package/dist/JCal/ZmanimUtils.js.map +0 -1
  38. package/dist/JCal/jDate.d.ts +0 -204
  39. package/dist/JCal/jDate.d.ts.map +0 -1
  40. package/dist/JCal/jDate.js +0 -648
  41. package/dist/JCal/jDate.js.map +0 -1
  42. package/dist/Locations.d.ts +0 -31
  43. package/dist/Locations.d.ts.map +0 -1
  44. package/dist/Locations.js +0 -153
  45. package/dist/Locations.js.map +0 -1
  46. package/dist/Notifications.d.ts +0 -18
  47. package/dist/Notifications.d.ts.map +0 -1
  48. package/dist/Notifications.js +0 -1039
  49. package/dist/Notifications.js.map +0 -1
  50. package/dist/Utils.d.ts +0 -287
  51. package/dist/Utils.d.ts.map +0 -1
  52. package/dist/Utils.js +0 -822
  53. package/dist/Utils.js.map +0 -1
  54. package/dist/ZmanTypes.d.ts +0 -41
  55. package/dist/ZmanTypes.d.ts.map +0 -1
  56. package/dist/ZmanTypes.js +0 -187
  57. package/dist/ZmanTypes.js.map +0 -1
  58. package/dist/index.d.ts.map +0 -1
  59. package/dist/locations.json +0 -1
@@ -1,31 +0,0 @@
1
- import Location from './JCal/Location.js';
2
- /**
3
- * NOTE: South and East are negative.
4
- */
5
- type Point = {
6
- latitude: number;
7
- longitude: number;
8
- };
9
- declare const Locations: any;
10
- /**
11
- * Find the Location (city) that is the closest to the given point of coordinates.
12
- * @param {Point} point
13
- * @returns
14
- */
15
- declare function closestDistanceMatch(point: Point): Location | undefined;
16
- /**
17
- * Find the Location (city) who's city name is the closest match to the given point of coordinates.
18
- * @param {string} val
19
- * @returns
20
- */
21
- declare function closestNameMatch(val: string): Location | undefined;
22
- /**
23
- * Option 1: Find a location with the given name
24
- * Option 2: Find the location with the name that is most similar to the given name
25
- * Option 3: Find the Location with the given coordinates
26
- * Option 4: Find the location closest to the given coordinates
27
- * @param {String|Point} nameOrCoordinates
28
- */
29
- declare function findLocation(nameOrCoordinates: string | Point): Location | undefined;
30
- export { Locations, findLocation, closestDistanceMatch, closestNameMatch };
31
- //# sourceMappingURL=Locations.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Locations.d.ts","sourceRoot":"","sources":["../src/Locations.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,oBAAoB,CAAC;AAK1C;;GAEG;AACH,KAAK,KAAK,GAAG;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC;AAGrD,QAAA,MAAM,SAAS,KAC8D,CAAC;AA+C9E;;;;GAIG;AACH,iBAAS,oBAAoB,CAAC,KAAK,EAAE,KAAK,GAAG,QAAQ,GAAG,SAAS,CAShE;AAED;;;;GAIG;AACH,iBAAS,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,CAW3D;AAED;;;;;;GAMG;AACH,iBAAS,YAAY,CAAC,iBAAiB,EAAE,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,SAAS,CA0B7E;AAED,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,CAAC"}
package/dist/Locations.js DELETED
@@ -1,153 +0,0 @@
1
- var __values = (this && this.__values) || function(o) {
2
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
3
- if (m) return m.call(o);
4
- if (o && typeof o.length === "number") return {
5
- next: function () {
6
- if (o && i >= o.length) o = void 0;
7
- return { value: o && o[i++], done: !o };
8
- }
9
- };
10
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
11
- };
12
- import Location from './JCal/Location.js';
13
- import { createRequire } from "module";
14
- import { distance } from 'closest-match';
15
- var require = createRequire(import.meta.url);
16
- var locations = require('./locations.json');
17
- var Locations = locations.map(function (l) {
18
- return new Location(l.name, l.heb, !!l.il, l.lat, l.lon, l.tz, l.el || 0, l.cl);
19
- });
20
- //Sort the Locations by name
21
- Locations.sort(function (a, b) {
22
- return a.Name > b.Name ? 1 : b.Name > a.Name ? -1 : 0;
23
- });
24
- //The location names and indexes - until the first comma and in lowercase.
25
- var justNames = [];
26
- for (var i = 0; i < Locations.length - 1; i++) {
27
- var l = Locations[i];
28
- justNames.push({
29
- name: l.Name.split(',', 1)[0].toLowerCase(), index: i
30
- });
31
- if (!!l.NameHebrew) {
32
- justNames.push({
33
- name: l.NameHebrew, index: i
34
- });
35
- }
36
- }
37
- /**
38
- * Get the distance between two points in Kilometers
39
- * @param {Point} point1
40
- * @param {Point} point2
41
- * @returns {number}
42
- */
43
- function distancePointToPoint(point1, point2) {
44
- if ((point1.latitude == point2.latitude) && (point1.longitude == point2.longitude)) {
45
- return 0;
46
- }
47
- else {
48
- var radlat1 = Math.PI * point1.latitude / 180;
49
- var radlat2 = Math.PI * point2.latitude / 180;
50
- var theta = point1.longitude - point2.longitude;
51
- var radtheta = Math.PI * theta / 180;
52
- var dist = Math.sin(radlat1) * Math.sin(radlat2) + Math.cos(radlat1) * Math.cos(radlat2) * Math.cos(radtheta);
53
- if (dist > 1) {
54
- dist = 1;
55
- }
56
- dist = Math.acos(dist);
57
- dist = dist * 180 / Math.PI;
58
- dist = dist * 60 * 1.1515;
59
- dist = dist * 1.609344;
60
- return dist;
61
- }
62
- }
63
- /**
64
- * Find the Location (city) that is the closest to the given point of coordinates.
65
- * @param {Point} point
66
- * @returns
67
- */
68
- function closestDistanceMatch(point) {
69
- var e_1, _a;
70
- var curr = { dist: 100000 };
71
- try {
72
- for (var Locations_1 = __values(Locations), Locations_1_1 = Locations_1.next(); !Locations_1_1.done; Locations_1_1 = Locations_1.next()) {
73
- var location_1 = Locations_1_1.value;
74
- var dist = distancePointToPoint(point, { latitude: location_1.Latitude, longitude: location_1.Longitude });
75
- if (dist < curr.dist) {
76
- curr = { dist: dist, location: location_1 };
77
- }
78
- }
79
- }
80
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
81
- finally {
82
- try {
83
- if (Locations_1_1 && !Locations_1_1.done && (_a = Locations_1.return)) _a.call(Locations_1);
84
- }
85
- finally { if (e_1) throw e_1.error; }
86
- }
87
- return curr.location;
88
- }
89
- /**
90
- * Find the Location (city) who's city name is the closest match to the given point of coordinates.
91
- * @param {string} val
92
- * @returns
93
- */
94
- function closestNameMatch(val) {
95
- var e_2, _a;
96
- var curr = { dist: 100000 };
97
- try {
98
- for (var justNames_1 = __values(justNames), justNames_1_1 = justNames_1.next(); !justNames_1_1.done; justNames_1_1 = justNames_1.next()) {
99
- var location_2 = justNames_1_1.value;
100
- var dist = distance(val.toLowerCase(), location_2.name);
101
- if (dist < curr.dist) {
102
- curr = { dist: dist, location: location_2 };
103
- }
104
- }
105
- }
106
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
107
- finally {
108
- try {
109
- if (justNames_1_1 && !justNames_1_1.done && (_a = justNames_1.return)) _a.call(justNames_1);
110
- }
111
- finally { if (e_2) throw e_2.error; }
112
- }
113
- return curr.location ? Locations[curr.location.index] : undefined;
114
- }
115
- /**
116
- * Option 1: Find a location with the given name
117
- * Option 2: Find the location with the name that is most similar to the given name
118
- * Option 3: Find the Location with the given coordinates
119
- * Option 4: Find the location closest to the given coordinates
120
- * @param {String|Point} nameOrCoordinates
121
- */
122
- function findLocation(nameOrCoordinates) {
123
- if (typeof nameOrCoordinates === 'string') {
124
- //First simply try to find an exact (case insensitive) match
125
- var exactNameMatch = Locations.find(function (l) {
126
- return l.Name.toLowerCase() === nameOrCoordinates.toLowerCase() || l.NameHebrew === nameOrCoordinates;
127
- });
128
- if (!!exactNameMatch) {
129
- return exactNameMatch;
130
- }
131
- //Next, we try to find an exact (case insensitive) match up untill the first comma
132
- var cityOnlyNameMatch = justNames.find(function (l) {
133
- return l.name === nameOrCoordinates.toLowerCase();
134
- });
135
- if (!!cityOnlyNameMatch) {
136
- return Locations[cityOnlyNameMatch.index];
137
- }
138
- //As a last resort, try to use some fancy algorithm to get the closest name match
139
- return closestNameMatch(nameOrCoordinates.toLowerCase());
140
- }
141
- else { //The given parameter is a Point of coordinates
142
- var exactCoordinateMatch = Locations.find(function (l) {
143
- return l.Latitude === nameOrCoordinates.latitude &&
144
- l.Longitude === nameOrCoordinates.longitude;
145
- });
146
- if (!!exactCoordinateMatch) {
147
- return exactCoordinateMatch;
148
- }
149
- return closestDistanceMatch(nameOrCoordinates);
150
- }
151
- }
152
- export { Locations, findLocation, closestDistanceMatch, closestNameMatch };
153
- //# sourceMappingURL=Locations.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Locations.js","sourceRoot":"","sources":["../src/Locations.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,IAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC/C,IAAM,SAAS,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAO9C,IAAM,SAAS,GAAG,SAAS,CAAC,GAAG,CAAC,UAAC,CAA6H;IAC1J,OAAA,IAAI,QAAQ,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;AAAxE,CAAwE,CAAC,CAAC;AAE9E,4BAA4B;AAC5B,SAAS,CAAC,IAAI,CAAC,UAAU,CAAU,EAAE,CAAU;IAC3C,OAAO,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC1D,CAAC,CAAC,CAAC;AACH,0EAA0E;AAC1E,IA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CAC2C,CAAC,CAAC;QACjD,IAAI,CAAC,CAAC,oBAAoB,EAAE;YACxB,OAAO,oBAAoB,CAAC;SAC/B;QACD,OAAO,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;KAClD;AACL,CAAC;AAED,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,CAAC"}
@@ -1,18 +0,0 @@
1
- import jDate from './JCal/jDate.js';
2
- import Location from './JCal/Location.js';
3
- import { Time } from './jcal-zmanim.js';
4
- /**
5
- * Get shul notifications for the given date and location
6
- * @param date
7
- * @param time
8
- * @param location
9
- * @param english
10
- * @param showGaonShir
11
- * @param showDafYomi
12
- * @returns {{ dayNotes: string[], tefillahNotes: string[]}}
13
- */
14
- export declare function getNotifications(date: jDate | Date, time: Time, location: Location, english: boolean, showGaonShir?: boolean, showDafYomi?: boolean): {
15
- dayNotes: string[];
16
- tefillahNotes: string[];
17
- };
18
- //# sourceMappingURL=Notifications.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Notifications.d.ts","sourceRoot":"","sources":["../src/Notifications.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,iBAAiB,CAAC;AAIpC,OAAO,QAAQ,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AA4BxC;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,KAAK,GAAG,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,YAAY,CAAC,EAAE,OAAO,EAAE,WAAW,CAAC,EAAE,OAAO;;;EAmFnJ"}