@unicom-cloud/utils 0.1.15 → 0.1.16

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.
@@ -1,450 +1,455 @@
1
- import { LunarMonth as d } from "./LunarMonth.js";
2
- import { LunarUtil as r } from "./LunarUtil.js";
3
- import { ShouXingUtil as u } from "./ShouXingUtil.js";
4
- import { Solar as f } from "./Solar.js";
5
- class h {
6
- _year;
7
- _ganIndex;
8
- _zhiIndex;
9
- _months;
10
- _jieQiJulianDays;
11
- static YUAN = ["", "上", "中"];
12
- static YUN = [
13
- "",
14
- "",
15
- "",
16
- "",
17
- "",
18
- "",
19
- "",
20
- "五",
21
- "六"
22
- ];
23
- static _LEAP_11 = [
24
- 75,
25
- 94,
26
- 170,
27
- 265,
28
- 322,
29
- 398,
30
- 469,
31
- 553,
32
- 583,
33
- 610,
34
- 678,
35
- 735,
36
- 754,
37
- 773,
38
- 849,
39
- 887,
40
- 936,
41
- 1050,
42
- 1069,
43
- 1126,
44
- 1145,
45
- 1164,
46
- 1183,
47
- 1259,
48
- 1278,
49
- 1308,
50
- 1373,
51
- 1403,
52
- 1441,
53
- 1460,
54
- 1498,
55
- 1555,
56
- 1593,
57
- 1612,
58
- 1631,
59
- 1642,
60
- 2033,
61
- 2128,
62
- 2147,
63
- 2242,
64
- 2614,
65
- 2728,
66
- 2910,
67
- 3062,
68
- 3244,
69
- 3339,
70
- 3616,
71
- 3711,
72
- 3730,
73
- 3825,
74
- 4007,
75
- 4159,
76
- 4197,
77
- 4322,
78
- 4341,
79
- 4379,
80
- 4417,
81
- 4531,
82
- 4599,
83
- 4694,
84
- 4713,
85
- 4789,
86
- 4808,
87
- 4971,
88
- 5085,
89
- 5104,
90
- 5161,
91
- 5180,
92
- 5199,
93
- 5294,
94
- 5305,
95
- 5476,
96
- 5677,
97
- 5696,
98
- 5772,
99
- 5791,
100
- 5848,
101
- 5886,
102
- 6049,
103
- 6068,
104
- 6144,
105
- 6163,
106
- 6258,
107
- 6402,
108
- 6440,
109
- 6497,
110
- 6516,
111
- 6630,
112
- 6641,
113
- 6660,
114
- 6679,
115
- 6736,
116
- 6774,
117
- 6850,
118
- 6869,
119
- 6899,
120
- 6918,
121
- 6994,
122
- 7013,
123
- 7032,
124
- 7051,
125
- 7070,
126
- 7089,
127
- 7108,
128
- 7127,
129
- 7146,
130
- 7222,
131
- 7271,
132
- 7290,
133
- 7309,
134
- 7366,
135
- 7385,
136
- 7404,
137
- 7442,
138
- 7461,
139
- 7480,
140
- 7491,
141
- 7499,
142
- 7594,
143
- 7624,
144
- 7643,
145
- 7662,
146
- 7681,
147
- 7719,
148
- 7738,
149
- 7814,
150
- 7863,
151
- 7882,
152
- 7901,
153
- 7939,
154
- 7958,
155
- 7977,
156
- 7996,
157
- 8034,
158
- 8053,
159
- 8072,
160
- 8091,
161
- 8121,
162
- 8159,
163
- 8186,
164
- 8216,
165
- 8235,
166
- 8254,
167
- 8273,
168
- 8311,
169
- 8330,
170
- 8341,
171
- 8349,
172
- 8368,
173
- 8444,
174
- 8463,
175
- 8474,
176
- 8493,
177
- 8531,
178
- 8569,
179
- 8588,
180
- 8626,
181
- 8664,
182
- 8683,
183
- 8694,
184
- 8702,
185
- 8713,
186
- 8721,
187
- 8751,
188
- 8789,
189
- 8808,
190
- 8816,
191
- 8827,
192
- 8846,
193
- 8884,
194
- 8903,
195
- 8922,
196
- 8941,
197
- 8971,
198
- 9036,
199
- 9066,
200
- 9085,
201
- 9104,
202
- 9123,
203
- 9142,
204
- 9161,
205
- 9180,
206
- 9199,
207
- 9218,
208
- 9256,
209
- 9294,
210
- 9313,
211
- 9324,
212
- 9343,
213
- 9362,
214
- 9381,
215
- 9419,
216
- 9438,
217
- 9476,
218
- 9514,
219
- 9533,
220
- 9544,
221
- 9552,
222
- 9563,
223
- 9571,
224
- 9582,
225
- 9601,
226
- 9639,
227
- 9658,
228
- 9666,
229
- 9677,
230
- 9696,
231
- 9734,
232
- 9753,
233
- 9772,
234
- 9791,
235
- 9802,
236
- 9821,
237
- 9886,
238
- 9897,
239
- 9916,
240
- 9935,
241
- 9954,
242
- 9973,
243
- 9992
244
- ];
245
- static _LEAP_12 = [
246
- 37,
247
- 56,
248
- 113,
249
- 132,
250
- 151,
251
- 189,
252
- 208,
253
- 227,
254
- 246,
255
- 284,
256
- 303,
257
- 341,
258
- 360,
259
- 379,
260
- 417,
261
- 436,
262
- 458,
263
- 477,
264
- 496,
265
- 515,
266
- 534,
267
- 572,
268
- 591,
269
- 629,
270
- 648,
271
- 667,
272
- 697,
273
- 716,
274
- 792,
275
- 811,
276
- 830,
277
- 868,
278
- 906,
279
- 925,
280
- 944,
281
- 963,
282
- 982,
283
- 1001,
284
- 1020,
285
- 1039,
286
- 1058,
287
- 1088,
288
- 1153,
289
- 1202,
290
- 1221,
291
- 1240,
292
- 1297,
293
- 1335,
294
- 1392,
295
- 1411,
296
- 1422,
297
- 1430,
298
- 1517,
299
- 1525,
300
- 1536,
301
- 1574,
302
- 3358,
303
- 3472,
304
- 3806,
305
- 3988,
306
- 4751,
307
- 4941,
308
- 5066,
309
- 5123,
310
- 5275,
311
- 5343,
312
- 5438,
313
- 5457,
314
- 5495,
315
- 5533,
316
- 5552,
317
- 5715,
318
- 5810,
319
- 5829,
320
- 5905,
321
- 5924,
322
- 6421,
323
- 6535,
324
- 6793,
325
- 6812,
326
- 6888,
327
- 6907,
328
- 7002,
329
- 7184,
330
- 7260,
331
- 7279,
332
- 7374,
333
- 7556,
334
- 7746,
335
- 7757,
336
- 7776,
337
- 7833,
338
- 7852,
339
- 7871,
340
- 7966,
341
- 8015,
342
- 8110,
343
- 8129,
344
- 8148,
345
- 8224,
346
- 8243,
347
- 8338,
348
- 8406,
349
- 8425,
350
- 8482,
351
- 8501,
352
- 8520,
353
- 8558,
354
- 8596,
355
- 8607,
356
- 8615,
357
- 8645,
358
- 8740,
359
- 8778,
360
- 8835,
361
- 8865,
362
- 8930,
363
- 8960,
364
- 8979,
365
- 8998,
366
- 9017,
367
- 9055,
368
- 9074,
369
- 9093,
370
- 9112,
371
- 9150,
372
- 9188,
373
- 9237,
374
- 9275,
375
- 9332,
376
- 9351,
377
- 9370,
378
- 9408,
379
- 9427,
380
- 9446,
381
- 9457,
382
- 9465,
383
- 9495,
384
- 9560,
385
- 9590,
386
- 9628,
387
- 9647,
388
- 9685,
389
- 9715,
390
- 9742,
391
- 9780,
392
- 9810,
393
- 9818,
394
- 9829,
395
- 9848,
396
- 9867,
397
- 9905,
398
- 9924,
399
- 9943,
400
- 9962,
401
- 1e4
402
- ];
403
- static _CACHE_YEAR = null;
404
- static fromYear(t) {
405
- let i;
406
- return !h._CACHE_YEAR || h._CACHE_YEAR.getYear() != t ? (i = new h(t), h._CACHE_YEAR = i) : i = h._CACHE_YEAR, i;
407
- }
408
- constructor(t) {
409
- this._year = t, this._months = [], this._jieQiJulianDays = [];
410
- const i = t - 4;
411
- let s = i % 10, n = i % 12;
412
- s < 0 && (s += 10), n < 0 && (n += 12), this._ganIndex = s, this._zhiIndex = n, this.compute();
1
+ import { LunarMonth as I } from "./LunarMonth.js";
2
+ import { LunarUtil as p } from "./LunarUtil.js";
3
+ import { ShouXingUtil as a } from "./ShouXingUtil.js";
4
+ import { Solar as d } from "./Solar.js";
5
+ class r {
6
+ static {
7
+ this.YUAN = ["下", "上", "中"];
8
+ }
9
+ static {
10
+ this.YUN = [
11
+ "",
12
+ "八",
13
+ "",
14
+ "",
15
+ "",
16
+ "",
17
+ "",
18
+ "",
19
+ ""
20
+ ];
21
+ }
22
+ static {
23
+ this._LEAP_11 = [
24
+ 75,
25
+ 94,
26
+ 170,
27
+ 265,
28
+ 322,
29
+ 398,
30
+ 469,
31
+ 553,
32
+ 583,
33
+ 610,
34
+ 678,
35
+ 735,
36
+ 754,
37
+ 773,
38
+ 849,
39
+ 887,
40
+ 936,
41
+ 1050,
42
+ 1069,
43
+ 1126,
44
+ 1145,
45
+ 1164,
46
+ 1183,
47
+ 1259,
48
+ 1278,
49
+ 1308,
50
+ 1373,
51
+ 1403,
52
+ 1441,
53
+ 1460,
54
+ 1498,
55
+ 1555,
56
+ 1593,
57
+ 1612,
58
+ 1631,
59
+ 1642,
60
+ 2033,
61
+ 2128,
62
+ 2147,
63
+ 2242,
64
+ 2614,
65
+ 2728,
66
+ 2910,
67
+ 3062,
68
+ 3244,
69
+ 3339,
70
+ 3616,
71
+ 3711,
72
+ 3730,
73
+ 3825,
74
+ 4007,
75
+ 4159,
76
+ 4197,
77
+ 4322,
78
+ 4341,
79
+ 4379,
80
+ 4417,
81
+ 4531,
82
+ 4599,
83
+ 4694,
84
+ 4713,
85
+ 4789,
86
+ 4808,
87
+ 4971,
88
+ 5085,
89
+ 5104,
90
+ 5161,
91
+ 5180,
92
+ 5199,
93
+ 5294,
94
+ 5305,
95
+ 5476,
96
+ 5677,
97
+ 5696,
98
+ 5772,
99
+ 5791,
100
+ 5848,
101
+ 5886,
102
+ 6049,
103
+ 6068,
104
+ 6144,
105
+ 6163,
106
+ 6258,
107
+ 6402,
108
+ 6440,
109
+ 6497,
110
+ 6516,
111
+ 6630,
112
+ 6641,
113
+ 6660,
114
+ 6679,
115
+ 6736,
116
+ 6774,
117
+ 6850,
118
+ 6869,
119
+ 6899,
120
+ 6918,
121
+ 6994,
122
+ 7013,
123
+ 7032,
124
+ 7051,
125
+ 7070,
126
+ 7089,
127
+ 7108,
128
+ 7127,
129
+ 7146,
130
+ 7222,
131
+ 7271,
132
+ 7290,
133
+ 7309,
134
+ 7366,
135
+ 7385,
136
+ 7404,
137
+ 7442,
138
+ 7461,
139
+ 7480,
140
+ 7491,
141
+ 7499,
142
+ 7594,
143
+ 7624,
144
+ 7643,
145
+ 7662,
146
+ 7681,
147
+ 7719,
148
+ 7738,
149
+ 7814,
150
+ 7863,
151
+ 7882,
152
+ 7901,
153
+ 7939,
154
+ 7958,
155
+ 7977,
156
+ 7996,
157
+ 8034,
158
+ 8053,
159
+ 8072,
160
+ 8091,
161
+ 8121,
162
+ 8159,
163
+ 8186,
164
+ 8216,
165
+ 8235,
166
+ 8254,
167
+ 8273,
168
+ 8311,
169
+ 8330,
170
+ 8341,
171
+ 8349,
172
+ 8368,
173
+ 8444,
174
+ 8463,
175
+ 8474,
176
+ 8493,
177
+ 8531,
178
+ 8569,
179
+ 8588,
180
+ 8626,
181
+ 8664,
182
+ 8683,
183
+ 8694,
184
+ 8702,
185
+ 8713,
186
+ 8721,
187
+ 8751,
188
+ 8789,
189
+ 8808,
190
+ 8816,
191
+ 8827,
192
+ 8846,
193
+ 8884,
194
+ 8903,
195
+ 8922,
196
+ 8941,
197
+ 8971,
198
+ 9036,
199
+ 9066,
200
+ 9085,
201
+ 9104,
202
+ 9123,
203
+ 9142,
204
+ 9161,
205
+ 9180,
206
+ 9199,
207
+ 9218,
208
+ 9256,
209
+ 9294,
210
+ 9313,
211
+ 9324,
212
+ 9343,
213
+ 9362,
214
+ 9381,
215
+ 9419,
216
+ 9438,
217
+ 9476,
218
+ 9514,
219
+ 9533,
220
+ 9544,
221
+ 9552,
222
+ 9563,
223
+ 9571,
224
+ 9582,
225
+ 9601,
226
+ 9639,
227
+ 9658,
228
+ 9666,
229
+ 9677,
230
+ 9696,
231
+ 9734,
232
+ 9753,
233
+ 9772,
234
+ 9791,
235
+ 9802,
236
+ 9821,
237
+ 9886,
238
+ 9897,
239
+ 9916,
240
+ 9935,
241
+ 9954,
242
+ 9973,
243
+ 9992
244
+ ];
245
+ }
246
+ static {
247
+ this._LEAP_12 = [
248
+ 37,
249
+ 56,
250
+ 113,
251
+ 132,
252
+ 151,
253
+ 189,
254
+ 208,
255
+ 227,
256
+ 246,
257
+ 284,
258
+ 303,
259
+ 341,
260
+ 360,
261
+ 379,
262
+ 417,
263
+ 436,
264
+ 458,
265
+ 477,
266
+ 496,
267
+ 515,
268
+ 534,
269
+ 572,
270
+ 591,
271
+ 629,
272
+ 648,
273
+ 667,
274
+ 697,
275
+ 716,
276
+ 792,
277
+ 811,
278
+ 830,
279
+ 868,
280
+ 906,
281
+ 925,
282
+ 944,
283
+ 963,
284
+ 982,
285
+ 1001,
286
+ 1020,
287
+ 1039,
288
+ 1058,
289
+ 1088,
290
+ 1153,
291
+ 1202,
292
+ 1221,
293
+ 1240,
294
+ 1297,
295
+ 1335,
296
+ 1392,
297
+ 1411,
298
+ 1422,
299
+ 1430,
300
+ 1517,
301
+ 1525,
302
+ 1536,
303
+ 1574,
304
+ 3358,
305
+ 3472,
306
+ 3806,
307
+ 3988,
308
+ 4751,
309
+ 4941,
310
+ 5066,
311
+ 5123,
312
+ 5275,
313
+ 5343,
314
+ 5438,
315
+ 5457,
316
+ 5495,
317
+ 5533,
318
+ 5552,
319
+ 5715,
320
+ 5810,
321
+ 5829,
322
+ 5905,
323
+ 5924,
324
+ 6421,
325
+ 6535,
326
+ 6793,
327
+ 6812,
328
+ 6888,
329
+ 6907,
330
+ 7002,
331
+ 7184,
332
+ 7260,
333
+ 7279,
334
+ 7374,
335
+ 7556,
336
+ 7746,
337
+ 7757,
338
+ 7776,
339
+ 7833,
340
+ 7852,
341
+ 7871,
342
+ 7966,
343
+ 8015,
344
+ 8110,
345
+ 8129,
346
+ 8148,
347
+ 8224,
348
+ 8243,
349
+ 8338,
350
+ 8406,
351
+ 8425,
352
+ 8482,
353
+ 8501,
354
+ 8520,
355
+ 8558,
356
+ 8596,
357
+ 8607,
358
+ 8615,
359
+ 8645,
360
+ 8740,
361
+ 8778,
362
+ 8835,
363
+ 8865,
364
+ 8930,
365
+ 8960,
366
+ 8979,
367
+ 8998,
368
+ 9017,
369
+ 9055,
370
+ 9074,
371
+ 9093,
372
+ 9112,
373
+ 9150,
374
+ 9188,
375
+ 9237,
376
+ 9275,
377
+ 9332,
378
+ 9351,
379
+ 9370,
380
+ 9408,
381
+ 9427,
382
+ 9446,
383
+ 9457,
384
+ 9465,
385
+ 9495,
386
+ 9560,
387
+ 9590,
388
+ 9628,
389
+ 9647,
390
+ 9685,
391
+ 9715,
392
+ 9742,
393
+ 9780,
394
+ 9810,
395
+ 9818,
396
+ 9829,
397
+ 9848,
398
+ 9867,
399
+ 9905,
400
+ 9924,
401
+ 9943,
402
+ 9962,
403
+ 1e4
404
+ ];
405
+ }
406
+ static {
407
+ this._CACHE_YEAR = null;
408
+ }
409
+ static fromYear(i) {
410
+ let e;
411
+ return !r._CACHE_YEAR || r._CACHE_YEAR.getYear() != i ? (e = new r(i), r._CACHE_YEAR = e) : e = r._CACHE_YEAR, e;
412
+ }
413
+ constructor(i) {
414
+ this._year = i, this._months = [], this._jieQiJulianDays = [];
415
+ const e = i - 4;
416
+ let n = e % 10, s = e % 12;
417
+ n < 0 && (n += 10), s < 0 && (s += 12), this._ganIndex = n, this._zhiIndex = s, this.compute();
413
418
  }
414
419
  compute() {
415
- const t = [], i = [], s = [], n = [];
416
- let e, _;
417
- const c = this._year;
418
- let l = Math.floor((c - 2e3) * 365.2422 + 180), g = Math.floor((l - 355 + 183) / 365.2422) * 365.2422 + 355;
419
- for (u.calcQi(g) > l && (g -= 365.2422), e = 0; e < 26; e++)
420
- t.push(u.calcQi(g + 15.2184 * e));
421
- for (e = 0, _ = r.JIE_QI_IN_USE.length; e < _; e++)
422
- e === 0 ? l = u.qiAccurate2(t[0] - 15.2184) : e <= 26 ? l = u.qiAccurate2(t[e - 1]) : l = u.qiAccurate2(t[25] + 15.2184 * (e - 26)), this._jieQiJulianDays.push(l + f.J2000);
423
- for (g = u.calcShuo(t[0]), g > t[0] && (g -= 29.53), e = 0; e < 16; e++)
424
- i.push(u.calcShuo(g + 29.5306 * e));
425
- for (e = 0; e < 15; e++)
426
- s.push(Math.floor(i[e + 1] - i[e])), n.push(e);
427
- const O = c - 1;
428
- let I = 16;
429
- if (h._LEAP_11.indexOf(c) > -1)
430
- I = 13;
431
- else if (h._LEAP_12.indexOf(c) > -1)
432
- I = 14;
433
- else if (i[13] <= t[24]) {
434
- for (e = 1; i[e + 1] > t[2 * e] && e < 13; )
435
- e++;
436
- I = e;
420
+ const i = [], e = [], n = [], s = [];
421
+ let t, f;
422
+ const u = this._year;
423
+ let c = Math.floor((u - 2e3) * 365.2422 + 180), l = Math.floor((c - 355 + 183) / 365.2422) * 365.2422 + 355;
424
+ for (a.calcQi(l) > c && (l -= 365.2422), t = 0; t < 26; t++)
425
+ i.push(a.calcQi(l + 15.2184 * t));
426
+ for (t = 0, f = p.JIE_QI_IN_USE.length; t < f; t++)
427
+ t === 0 ? c = a.qiAccurate2(i[0] - 15.2184) : t <= 26 ? c = a.qiAccurate2(i[t - 1]) : c = a.qiAccurate2(i[25] + 15.2184 * (t - 26)), this._jieQiJulianDays.push(c + d.J2000);
428
+ for (l = a.calcShuo(i[0]), l > i[0] && (l -= 29.53), t = 0; t < 16; t++)
429
+ e.push(a.calcShuo(l + 29.5306 * t));
430
+ for (t = 0; t < 15; t++)
431
+ n.push(Math.floor(e[t + 1] - e[t])), s.push(t);
432
+ const E = u - 1;
433
+ let _ = 16;
434
+ if (r._LEAP_11.indexOf(u) > -1)
435
+ _ = 13;
436
+ else if (r._LEAP_12.indexOf(u) > -1)
437
+ _ = 14;
438
+ else if (e[13] <= i[24]) {
439
+ for (t = 1; e[t + 1] > i[2 * t] && t < 13; )
440
+ t++;
441
+ _ = t;
437
442
  }
438
- for (_ = I; _ < 15; _++)
439
- n[_] -= 1;
440
- const m = [11, 12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
441
- let y = -1, Z = -1, S = O;
442
- for (e = 0; e < 15; e++) {
443
- const a = i[e] + f.J2000, P = n[e];
444
- let o = m[P % 12];
445
- 1724360 <= a && a < 1729794 || 1807724 <= a && a < 1808699 ? o = m[(P + 1) % 12] : (a == 1729794 || a == 1808699) && (o = 12), y == -1 && (y = o, Z = o), o < y && (S += 1, Z = 1), y = o, e == I ? o = -o : (a == 1729794 || a == 1808699) && (o = -11), this._months.push(
446
- new d(S, o, s[e], i[e] + f.J2000, Z)
447
- ), Z++;
443
+ for (f = _; f < 15; f++)
444
+ s[f] -= 1;
445
+ const y = [11, 12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
446
+ let g = -1, m = -1, x = E;
447
+ for (t = 0; t < 15; t++) {
448
+ const o = e[t] + d.J2000, A = s[t];
449
+ let h = y[A % 12];
450
+ 1724360 <= o && o < 1729794 || 1807724 <= o && o < 1808699 ? h = y[(A + 1) % 12] : (o == 1729794 || o == 1808699) && (h = 12), g == -1 && (g = h, m = h), h < g && (x += 1, m = 1), g = h, t == _ ? h = -h : (o == 1729794 || o == 1808699) && (h = -11), this._months.push(
451
+ new I(x, h, n[t], e[t] + d.J2000, m)
452
+ ), m++;
448
453
  }
449
454
  }
450
455
  getYear() {
@@ -457,10 +462,10 @@ class h {
457
462
  return this._zhiIndex;
458
463
  }
459
464
  getGan() {
460
- return r.GAN[this._ganIndex + 1];
465
+ return p.GAN[this._ganIndex + 1];
461
466
  }
462
467
  getZhi() {
463
- return r.ZHI[this._zhiIndex + 1];
468
+ return p.ZHI[this._zhiIndex + 1];
464
469
  }
465
470
  getGanZhi() {
466
471
  return this.getGan() + this.getZhi();
@@ -469,37 +474,37 @@ class h {
469
474
  return this._jieQiJulianDays;
470
475
  }
471
476
  getDayCount() {
472
- let t = 0;
473
- for (let i = 0, s = this._months.length; i < s; i++) {
474
- const n = this._months[i];
475
- n.getYear() == this._year && (t += n.getDayCount());
477
+ let i = 0;
478
+ for (let e = 0, n = this._months.length; e < n; e++) {
479
+ const s = this._months[e];
480
+ s.getYear() == this._year && (i += s.getDayCount());
476
481
  }
477
- return t;
482
+ return i;
478
483
  }
479
484
  getMonths() {
480
485
  return this._months;
481
486
  }
482
487
  getMonthsInYear() {
483
- const t = [];
484
- for (let i = 0, s = this._months.length; i < s; i++) {
485
- const n = this._months[i];
486
- n.getYear() == this._year && t.push(n);
488
+ const i = [];
489
+ for (let e = 0, n = this._months.length; e < n; e++) {
490
+ const s = this._months[e];
491
+ s.getYear() == this._year && i.push(s);
487
492
  }
488
- return t;
493
+ return i;
489
494
  }
490
- getMonth(t) {
491
- for (let i = 0, s = this._months.length; i < s; i++) {
492
- const n = this._months[i];
493
- if (n.getYear() == this._year && n.getMonth() == t)
494
- return n;
495
+ getMonth(i) {
496
+ for (let e = 0, n = this._months.length; e < n; e++) {
497
+ const s = this._months[e];
498
+ if (s.getYear() == this._year && s.getMonth() == i)
499
+ return s;
495
500
  }
496
501
  return null;
497
502
  }
498
503
  getLeapMonth() {
499
- for (let t = 0, i = this._months.length; t < i; t++) {
500
- const s = this._months[t];
501
- if (s.getYear() == this._year && s.isLeap())
502
- return Math.abs(s.getMonth());
504
+ for (let i = 0, e = this._months.length; i < e; i++) {
505
+ const n = this._months[i];
506
+ if (n.getYear() == this._year && n.isLeap())
507
+ return Math.abs(n.getMonth());
503
508
  }
504
509
  return 0;
505
510
  }
@@ -509,108 +514,10 @@ class h {
509
514
  toFullString() {
510
515
  return `${this.getYear()}年`;
511
516
  }
512
- _getZaoByGan(t, i) {
513
- const s = this.getMonth(1);
514
- if (s == null)
515
- return "";
516
- let n = t - f.fromJulianDay(s.getFirstJulianDay()).getLunar().getDayGanIndex();
517
- return n < 0 && (n += 10), i.replace("几", r.NUMBER[n + 1]);
518
- }
519
- _getZaoByZhi(t, i) {
520
- const s = this.getMonth(1);
521
- if (s == null)
522
- return "";
523
- let n = t - f.fromJulianDay(s.getFirstJulianDay()).getLunar().getDayZhiIndex();
524
- return n < 0 && (n += 12), i.replace("几", r.NUMBER[n + 1]);
525
- }
526
- getTouLiang() {
527
- return this._getZaoByZhi(0, "几鼠偷粮");
528
- }
529
- getCaoZi() {
530
- return this._getZaoByZhi(0, "草子几分");
531
- }
532
- getGengTian() {
533
- return this._getZaoByZhi(1, "几牛耕田");
534
- }
535
- getHuaShou() {
536
- return this._getZaoByZhi(3, "花收几分");
537
- }
538
- getZhiShui() {
539
- return this._getZaoByZhi(4, "几龙治水");
540
- }
541
- getTuoGu() {
542
- return this._getZaoByZhi(6, "几马驮谷");
543
- }
544
- getQiangMi() {
545
- return this._getZaoByZhi(9, "几鸡抢米");
546
- }
547
- getKanCan() {
548
- return this._getZaoByZhi(9, "几姑看蚕");
549
- }
550
- getGongZhu() {
551
- return this._getZaoByZhi(11, "几屠共猪");
552
- }
553
- getJiaTian() {
554
- return this._getZaoByGan(0, "甲田几分");
555
- }
556
- getFenBing() {
557
- return this._getZaoByGan(2, "几人分饼");
558
- }
559
- getDeJin() {
560
- return this._getZaoByGan(7, "几日得金");
561
- }
562
- getRenBing() {
563
- return this._getZaoByGan(2, this._getZaoByZhi(2, "几人几丙"));
564
- }
565
- getRenChu() {
566
- return this._getZaoByGan(3, this._getZaoByZhi(2, "几人几锄"));
567
- }
568
- getYuan() {
569
- return h.YUAN[Math.floor((this._year + 2696) / 60) % 3] + "元";
570
- }
571
- getYun() {
572
- return h.YUN[Math.floor((this._year + 2696) / 20) % 9] + "运";
573
- }
574
- getPositionXi() {
575
- return r.POSITION_XI[this._ganIndex + 1];
576
- }
577
- getPositionXiDesc() {
578
- return r.POSITION_DESC[this.getPositionXi()];
579
- }
580
- getPositionYangGui() {
581
- return r.POSITION_YANG_GUI[this._ganIndex + 1];
582
- }
583
- getPositionYangGuiDesc() {
584
- return r.POSITION_DESC[this.getPositionYangGui()];
585
- }
586
- getPositionYinGui() {
587
- return r.POSITION_YIN_GUI[this._ganIndex + 1];
588
- }
589
- getPositionYinGuiDesc() {
590
- return r.POSITION_DESC[this.getPositionYinGui()];
591
- }
592
- getPositionFu(t = 2) {
593
- return (t == 1 ? r.POSITION_FU : r.POSITION_FU_2)[this._ganIndex + 1];
594
- }
595
- getPositionFuDesc(t = 2) {
596
- return r.POSITION_DESC[this.getPositionFu(t)];
597
- }
598
- getPositionCai() {
599
- return r.POSITION_CAI[this._ganIndex + 1];
600
- }
601
- getPositionCaiDesc() {
602
- return r.POSITION_DESC[this.getPositionCai()];
603
- }
604
- getPositionTaiSui() {
605
- return r.POSITION_TAI_SUI_YEAR[this._zhiIndex];
606
- }
607
- getPositionTaiSuiDesc() {
608
- return r.POSITION_DESC[this.getPositionTaiSui()];
609
- }
610
- next(t) {
611
- return h.fromYear(this._year + t);
517
+ next(i) {
518
+ return r.fromYear(this._year + i);
612
519
  }
613
520
  }
614
521
  export {
615
- h as LunarYear
522
+ r as LunarYear
616
523
  };