@unicom-cloud/utils 0.1.10 → 0.1.12
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/caseName.js +11 -0
- package/className.js +5 -0
- package/clipboardCopy.js +6 -0
- package/constant.js +4 -0
- package/contentDisposition.js +7 -0
- package/cookie.js +7 -0
- package/date/convertTime.js +61 -0
- package/date/index.js +22 -0
- package/date.js +9 -0
- package/decimal.js +5 -0
- package/eventEmitter.js +4 -0
- package/file.js +6 -0
- package/filesize.js +8 -0
- package/index.js +56 -46
- package/invariant.js +4 -0
- package/is.js +92 -0
- package/lunar/index.js +36 -0
- package/lunar/lib/Holiday.js +42 -0
- package/lunar/lib/HolidayUtil.js +128 -0
- package/lunar/lib/I18n.js +1005 -0
- package/lunar/lib/JieQi.js +40 -0
- package/lunar/lib/Lunar.js +1035 -0
- package/lunar/lib/LunarMonth.js +150 -0
- package/lunar/lib/LunarTime.js +138 -0
- package/lunar/lib/LunarUtil.js +1752 -0
- package/lunar/lib/LunarYear.js +616 -0
- package/lunar/lib/ShouXingUtil.js +6915 -0
- package/lunar/lib/Solar.js +311 -0
- package/lunar/lib/SolarHalfYear.js +45 -0
- package/lunar/lib/SolarMonth.js +55 -0
- package/lunar/lib/SolarSeason.js +42 -0
- package/lunar/lib/SolarUtil.js +256 -0
- package/lunar/lib/SolarWeek.js +153 -0
- package/lunar/lib/SolarYear.js +35 -0
- package/lunar/lib/index.js +35 -0
- package/lunar.js +36 -0
- package/math.js +9 -0
- package/md5.js +4 -0
- package/mock.js +8 -0
- package/normalizeWheel.js +6 -0
- package/number-to-chinese/index.js +72 -0
- package/numberToChinese.js +4 -0
- package/nzh.js +4 -0
- package/object-keys-sort/index.js +7 -0
- package/objectKeysSort.js +2 -5
- package/package.json +1 -1
- package/random.js +15 -0
- package/screenfull.js +4 -0
- package/snapdom/src/api/preCache.js +26 -36
- package/snapdom/src/api/snapdom.js +78 -61
- package/snapdom/src/core/capture.js +54 -54
- package/snapdom/src/core/prepare.js +46 -37
- package/snapdom/src/modules/fonts.js +90 -92
- package/snapdom/src/modules/iconFonts.js +28 -0
- package/snapdom/src/modules/images.js +6 -6
- package/snapdom/src/modules/pseudo.js +51 -49
- package/snapdom/src/modules/styles.js +27 -7
- package/snapdom/src/modules/svgDefs.js +26 -0
- package/snapdom/src/utils/helpers.js +150 -103
- package/snapdom.js +6 -0
- package/tinycolor/index.js +46 -0
- package/tinycolor/src/conversion.js +143 -0
- package/tinycolor/src/css-color-names.js +153 -0
- package/tinycolor/src/format-input.js +77 -0
- package/tinycolor/src/from-ratio.js +21 -0
- package/tinycolor/src/index.js +404 -0
- package/tinycolor/src/random.js +221 -0
- package/tinycolor/src/readability.js +37 -0
- package/tinycolor/src/to-ms-filter.js +15 -0
- package/tinycolor/src/util.js +32 -0
- package/tinycolor.js +46 -0
- package/tree/index.js +10 -8
- package/tree/searchTree.js +54 -0
- package/tree.js +13 -0
- package/turboStream.js +6 -0
- package/types/case-name/index.d.ts +11 -0
- package/types/class-name/index.d.ts +2 -0
- package/types/clipboard-copy/index.d.ts +2 -0
- package/types/constant/address.d.ts +14 -0
- package/types/constant/chineseCharacters.d.ts +2 -0
- package/types/constant/constellations.d.ts +2 -0
- package/types/constant/domain.d.ts +2 -0
- package/types/constant/identity.d.ts +2 -0
- package/types/constant/index.d.ts +1 -0
- package/types/constant/keyboardCode.d.ts +158 -0
- package/types/constant/licensePlate.d.ts +2 -0
- package/types/constant/name.d.ts +4 -0
- package/types/constant/platform.d.ts +11 -0
- package/types/constant/protocol.d.ts +2 -0
- package/types/constant/ui.d.ts +14 -0
- package/types/content-disposition/index.d.ts +10 -0
- package/types/cookie/index.d.ts +4 -0
- package/types/cookie/src/index.d.ts +114 -0
- package/types/date/convertTime.d.ts +32 -0
- package/types/date/index.d.ts +4 -0
- package/types/decimal/decimal.d.ts +4 -0
- package/types/decimal/index.d.ts +1 -0
- package/types/event-emitter/index.d.ts +17 -0
- package/types/file/fileToURL.d.ts +2 -0
- package/types/file/index.d.ts +3 -0
- package/types/file/saveAs.d.ts +2 -0
- package/types/filesize/index.d.ts +2 -0
- package/types/filesize/src/constants.d.ts +42 -0
- package/types/filesize/src/filesize.d.ts +47 -0
- package/types/index.d.ts +25 -0
- package/types/invariant/index.d.ts +2 -0
- package/types/is/index.d.ts +53 -0
- package/types/lunar/index.d.ts +3 -0
- package/types/lunar/lib/Holiday.d.ts +17 -0
- package/types/lunar/lib/HolidayUtil.d.ts +23 -0
- package/types/lunar/lib/I18n.d.ts +23 -0
- package/types/lunar/lib/JieQi.d.ts +15 -0
- package/types/lunar/lib/Lunar.d.ts +245 -0
- package/types/lunar/lib/LunarMonth.d.ts +35 -0
- package/types/lunar/lib/LunarTime.d.ts +40 -0
- package/types/lunar/lib/LunarUtil.d.ts +128 -0
- package/types/lunar/lib/LunarYear.d.ts +61 -0
- package/types/lunar/lib/ShouXingUtil.d.ts +38 -0
- package/types/lunar/lib/Solar.d.ts +51 -0
- package/types/lunar/lib/SolarHalfYear.d.ts +15 -0
- package/types/lunar/lib/SolarMonth.d.ts +16 -0
- package/types/lunar/lib/SolarSeason.d.ts +15 -0
- package/types/lunar/lib/SolarUtil.d.ts +20 -0
- package/types/lunar/lib/SolarWeek.d.ts +23 -0
- package/types/lunar/lib/SolarYear.d.ts +12 -0
- package/types/lunar/lib/index.d.ts +17 -0
- package/types/math/index.d.ts +11 -0
- package/types/md5/index.d.ts +2 -0
- package/types/mock/MockWebSocket.d.ts +17 -0
- package/types/mock/MockXMLHttpRequest.d.ts +17 -0
- package/types/mock/index.d.ts +2 -0
- package/types/normalize-wheel/ExecutionEnvironment.d.ts +9 -0
- package/types/normalize-wheel/UserAgent_DEPRECATED.d.ts +86 -0
- package/types/normalize-wheel/index.d.ts +115 -0
- package/types/normalize-wheel/isEventSupported.d.ts +16 -0
- package/types/number-to-chinese/index.d.ts +11 -0
- package/types/nzh/cn.d.ts +8 -0
- package/types/nzh/hk.d.ts +8 -0
- package/types/nzh/index.d.ts +1 -0
- package/types/nzh/nzh.d.ts +36 -0
- package/types/nzh/src/autoGet.d.ts +8 -0
- package/types/nzh/src/index.d.ts +34 -0
- package/types/nzh/src/langs/cn_b.d.ts +10 -0
- package/types/nzh/src/langs/cn_s.d.ts +7 -0
- package/types/nzh/src/langs/hk_b.d.ts +10 -0
- package/types/nzh/src/langs/hk_s.d.ts +7 -0
- package/types/nzh/src/utils.d.ts +65 -0
- package/types/object-keys-sort/index.d.ts +4 -0
- package/types/random/address.d.ts +8 -0
- package/types/random/constellation.d.ts +2 -0
- package/types/random/image.d.ts +5 -0
- package/types/random/index.d.ts +40 -0
- package/types/random/licensePlate.d.ts +2 -0
- package/types/random/name.d.ts +9 -0
- package/types/random/number.d.ts +6 -0
- package/types/random/text.d.ts +13 -0
- package/types/random/time.d.ts +2 -0
- package/types/random/web.d.ts +11 -0
- package/types/screenfull/index.d.ts +10 -0
- package/types/snapdom/index.d.ts +1 -0
- package/types/snapdom/src/api/preCache.d.ts +8 -0
- package/types/snapdom/src/api/snapdom.d.ts +26 -0
- package/types/snapdom/src/core/cache.d.ts +11 -0
- package/types/snapdom/src/core/capture.d.ts +17 -0
- package/types/snapdom/src/core/clone.d.ts +11 -0
- package/types/snapdom/src/core/prepare.d.ts +8 -0
- package/types/snapdom/src/index.browser.d.ts +1 -0
- package/types/snapdom/src/index.d.ts +2 -0
- package/types/snapdom/src/modules/background.d.ts +10 -0
- package/types/snapdom/src/modules/fonts.d.ts +23 -0
- package/types/snapdom/src/modules/iconFonts.d.ts +2 -0
- package/types/snapdom/src/modules/images.d.ts +8 -0
- package/types/snapdom/src/modules/pseudo.d.ts +12 -0
- package/types/snapdom/src/modules/styles.d.ts +1 -0
- package/types/snapdom/src/modules/svgDefs.d.ts +19 -0
- package/types/snapdom/src/utils/cssTools.d.ts +38 -0
- package/types/snapdom/src/utils/helpers.d.ts +71 -0
- package/types/tinycolor/index.d.ts +2 -0
- package/types/tinycolor/src/conversion.d.ts +79 -0
- package/types/tinycolor/src/css-color-names.d.ts +4 -0
- package/types/tinycolor/src/format-input.d.ts +38 -0
- package/types/tinycolor/src/from-ratio.d.ts +14 -0
- package/types/tinycolor/src/index.d.ts +214 -0
- package/types/tinycolor/src/interfaces.d.ts +57 -0
- package/types/tinycolor/src/public_api.d.ts +10 -0
- package/types/tinycolor/src/random.d.ts +24 -0
- package/types/tinycolor/src/readability.d.ts +46 -0
- package/types/tinycolor/src/to-ms-filter.d.ts +5 -0
- package/types/tinycolor/src/umd_api.d.ts +22 -0
- package/types/tinycolor/src/util.d.ts +36 -0
- package/types/tree/index.d.ts +9 -0
- package/types/tree/searchTree.d.ts +20 -0
- package/types/turbo-stream/index.d.ts +1 -0
- package/types/turbo-stream/src/decode.d.ts +7 -0
- package/types/turbo-stream/src/encode.d.ts +27 -0
- package/types/turbo-stream/src/shared.d.ts +107 -0
- package/types/turbo-stream/src/turbo-stream.d.ts +4 -0
- package/types/ui-color/compareColorByRange.d.ts +2 -0
- package/types/ui-color/index.d.ts +183 -0
- package/types/url-toolkit/index.d.ts +2 -0
- package/types/url-toolkit/src/url-toolkit.d.ts +18 -0
- package/ui-color/compareColorByRange.js +9 -0
- package/ui-color/index.js +155 -0
- package/uiColor.js +28 -0
- package/urlToolkit.js +8 -0
- package/dayjs/index.js +0 -15
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
import { Solar as c } from "./Solar.js";
|
|
2
|
+
class t {
|
|
3
|
+
static WEEK = [
|
|
4
|
+
"{w.sun}",
|
|
5
|
+
"{w.mon}",
|
|
6
|
+
"{w.tues}",
|
|
7
|
+
"{w.wed}",
|
|
8
|
+
"{w.thur}",
|
|
9
|
+
"{w.fri}",
|
|
10
|
+
"{w.sat}"
|
|
11
|
+
];
|
|
12
|
+
static DAYS_OF_MONTH = [
|
|
13
|
+
31,
|
|
14
|
+
28,
|
|
15
|
+
31,
|
|
16
|
+
30,
|
|
17
|
+
31,
|
|
18
|
+
30,
|
|
19
|
+
31,
|
|
20
|
+
31,
|
|
21
|
+
30,
|
|
22
|
+
31,
|
|
23
|
+
30,
|
|
24
|
+
31
|
|
25
|
+
];
|
|
26
|
+
static XINGZUO = [
|
|
27
|
+
"{xz.aries}",
|
|
28
|
+
"{xz.taurus}",
|
|
29
|
+
"{xz.gemini}",
|
|
30
|
+
"{xz.cancer}",
|
|
31
|
+
"{xz.leo}",
|
|
32
|
+
"{xz.virgo}",
|
|
33
|
+
"{xz.libra}",
|
|
34
|
+
"{xz.scorpio}",
|
|
35
|
+
"{xz.sagittarius}",
|
|
36
|
+
"{xz.capricornus}",
|
|
37
|
+
"{xz.aquarius}",
|
|
38
|
+
"{xz.pisces}"
|
|
39
|
+
];
|
|
40
|
+
static FESTIVAL = {
|
|
41
|
+
"1-1": "{jr.yuanDan}",
|
|
42
|
+
"2-14": "{jr.qingRen}",
|
|
43
|
+
"3-8": "{jr.fuNv}",
|
|
44
|
+
"3-12": "{jr.zhiShu}",
|
|
45
|
+
"3-15": "{jr.xiaoFei}",
|
|
46
|
+
"4-1": "{jr.yuRen}",
|
|
47
|
+
"5-1": "{jr.wuYi}",
|
|
48
|
+
"5-4": "{jr.qingNian}",
|
|
49
|
+
"6-1": "{jr.erTong}",
|
|
50
|
+
"7-1": "{jr.jianDang}",
|
|
51
|
+
"8-1": "{jr.jianJun}",
|
|
52
|
+
"9-10": "{jr.jiaoShi}",
|
|
53
|
+
"10-1": "{jr.guoQing}",
|
|
54
|
+
"10-31": "{jr.wanShengYe}",
|
|
55
|
+
"11-1": "{jr.wanSheng}",
|
|
56
|
+
"12-24": "{jr.pingAn}",
|
|
57
|
+
"12-25": "{jr.shengDan}"
|
|
58
|
+
};
|
|
59
|
+
static OTHER_FESTIVAL = {
|
|
60
|
+
"1-8": ["周恩来逝世纪念日"],
|
|
61
|
+
"1-10": ["中国人民警察节"],
|
|
62
|
+
"1-14": ["日记情人节"],
|
|
63
|
+
"1-21": ["列宁逝世纪念日"],
|
|
64
|
+
"1-26": ["国际海关日"],
|
|
65
|
+
"1-27": ["国际大屠杀纪念日"],
|
|
66
|
+
"2-2": ["世界湿地日"],
|
|
67
|
+
"2-4": ["世界抗癌日"],
|
|
68
|
+
"2-7": ["京汉铁路罢工纪念日"],
|
|
69
|
+
"2-10": ["国际气象节"],
|
|
70
|
+
"2-19": ["邓小平逝世纪念日"],
|
|
71
|
+
"2-20": ["世界社会公正日"],
|
|
72
|
+
"2-21": ["国际母语日"],
|
|
73
|
+
"2-24": ["第三世界青年日"],
|
|
74
|
+
"3-1": ["国际海豹日"],
|
|
75
|
+
"3-3": ["世界野生动植物日", "全国爱耳日"],
|
|
76
|
+
"3-5": ["周恩来诞辰纪念日", "中国青年志愿者服务日"],
|
|
77
|
+
"3-6": ["世界青光眼日"],
|
|
78
|
+
"3-7": ["女生节"],
|
|
79
|
+
"3-12": ["孙中山逝世纪念日"],
|
|
80
|
+
"3-14": ["马克思逝世纪念日", "白色情人节"],
|
|
81
|
+
"3-17": ["国际航海日"],
|
|
82
|
+
"3-18": ["全国科技人才活动日", "全国爱肝日"],
|
|
83
|
+
"3-20": ["国际幸福日"],
|
|
84
|
+
"3-21": ["世界森林日", "世界睡眠日", "国际消除种族歧视日"],
|
|
85
|
+
"3-22": ["世界水日"],
|
|
86
|
+
"3-23": ["世界气象日"],
|
|
87
|
+
"3-24": ["世界防治结核病日"],
|
|
88
|
+
"3-29": ["中国黄花岗七十二烈士殉难纪念日"],
|
|
89
|
+
"4-2": ["国际儿童图书日", "世界自闭症日"],
|
|
90
|
+
"4-4": ["国际地雷行动日"],
|
|
91
|
+
"4-7": ["世界卫生日"],
|
|
92
|
+
"4-8": ["国际珍稀动物保护日"],
|
|
93
|
+
"4-12": ["世界航天日"],
|
|
94
|
+
"4-14": ["黑色情人节"],
|
|
95
|
+
"4-15": ["全民国家安全教育日"],
|
|
96
|
+
"4-22": ["世界地球日", "列宁诞辰纪念日"],
|
|
97
|
+
"4-23": ["世界读书日"],
|
|
98
|
+
"4-24": ["中国航天日"],
|
|
99
|
+
"4-25": ["儿童预防接种宣传日"],
|
|
100
|
+
"4-26": ["世界知识产权日", "全国疟疾日"],
|
|
101
|
+
"4-28": ["世界安全生产与健康日"],
|
|
102
|
+
"4-30": ["全国交通安全反思日"],
|
|
103
|
+
"5-2": ["世界金枪鱼日"],
|
|
104
|
+
"5-3": ["世界新闻自由日"],
|
|
105
|
+
"5-5": ["马克思诞辰纪念日"],
|
|
106
|
+
"5-8": ["世界红十字日"],
|
|
107
|
+
"5-11": ["世界肥胖日"],
|
|
108
|
+
"5-12": ["全国防灾减灾日", "护士节"],
|
|
109
|
+
"5-14": ["玫瑰情人节"],
|
|
110
|
+
"5-15": ["国际家庭日"],
|
|
111
|
+
"5-19": ["中国旅游日"],
|
|
112
|
+
"5-20": ["网络情人节"],
|
|
113
|
+
"5-22": ["国际生物多样性日"],
|
|
114
|
+
"5-25": ["525心理健康节"],
|
|
115
|
+
"5-27": ["上海解放日"],
|
|
116
|
+
"5-29": ["国际维和人员日"],
|
|
117
|
+
"5-30": ["中国五卅运动纪念日"],
|
|
118
|
+
"5-31": ["世界无烟日"],
|
|
119
|
+
"6-3": ["世界自行车日"],
|
|
120
|
+
"6-5": ["世界环境日"],
|
|
121
|
+
"6-6": ["全国爱眼日"],
|
|
122
|
+
"6-8": ["世界海洋日"],
|
|
123
|
+
"6-11": ["中国人口日"],
|
|
124
|
+
"6-14": ["世界献血日", "亲亲情人节"],
|
|
125
|
+
"6-17": ["世界防治荒漠化与干旱日"],
|
|
126
|
+
"6-20": ["世界难民日"],
|
|
127
|
+
"6-21": ["国际瑜伽日"],
|
|
128
|
+
"6-25": ["全国土地日"],
|
|
129
|
+
"6-26": ["国际禁毒日", "联合国宪章日"],
|
|
130
|
+
"7-1": ["香港回归纪念日"],
|
|
131
|
+
"7-6": ["国际接吻日", "朱德逝世纪念日"],
|
|
132
|
+
"7-7": ["七七事变纪念日"],
|
|
133
|
+
"7-11": ["世界人口日", "中国航海日"],
|
|
134
|
+
"7-14": ["银色情人节"],
|
|
135
|
+
"7-18": ["曼德拉国际日"],
|
|
136
|
+
"7-30": ["国际友谊日"],
|
|
137
|
+
"8-3": ["男人节"],
|
|
138
|
+
"8-5": ["恩格斯逝世纪念日"],
|
|
139
|
+
"8-6": ["国际电影节"],
|
|
140
|
+
"8-8": ["全民健身日"],
|
|
141
|
+
"8-9": ["国际土著人日"],
|
|
142
|
+
"8-12": ["国际青年节"],
|
|
143
|
+
"8-14": ["绿色情人节"],
|
|
144
|
+
"8-19": ["世界人道主义日", "中国医师节"],
|
|
145
|
+
"8-22": ["邓小平诞辰纪念日"],
|
|
146
|
+
"8-29": ["全国测绘法宣传日"],
|
|
147
|
+
"9-3": ["中国抗日战争胜利纪念日"],
|
|
148
|
+
"9-5": ["中华慈善日"],
|
|
149
|
+
"9-8": ["世界扫盲日"],
|
|
150
|
+
"9-9": ["毛泽东逝世纪念日", "全国拒绝酒驾日"],
|
|
151
|
+
"9-14": ["世界清洁地球日", "相片情人节"],
|
|
152
|
+
"9-15": ["国际民主日"],
|
|
153
|
+
"9-16": ["国际臭氧层保护日"],
|
|
154
|
+
"9-17": ["世界骑行日"],
|
|
155
|
+
"9-18": ["九一八事变纪念日"],
|
|
156
|
+
"9-20": ["全国爱牙日"],
|
|
157
|
+
"9-21": ["国际和平日"],
|
|
158
|
+
"9-27": ["世界旅游日"],
|
|
159
|
+
"9-30": ["中国烈士纪念日"],
|
|
160
|
+
"10-1": ["国际老年人日"],
|
|
161
|
+
"10-2": ["国际非暴力日"],
|
|
162
|
+
"10-4": ["世界动物日"],
|
|
163
|
+
"10-11": ["国际女童日"],
|
|
164
|
+
"10-10": ["辛亥革命纪念日"],
|
|
165
|
+
"10-13": ["国际减轻自然灾害日", "中国少年先锋队诞辰日"],
|
|
166
|
+
"10-14": ["葡萄酒情人节"],
|
|
167
|
+
"10-16": ["世界粮食日"],
|
|
168
|
+
"10-17": ["全国扶贫日"],
|
|
169
|
+
"10-20": ["世界统计日"],
|
|
170
|
+
"10-24": ["世界发展信息日", "程序员节"],
|
|
171
|
+
"10-25": ["抗美援朝纪念日"],
|
|
172
|
+
"11-5": ["世界海啸日"],
|
|
173
|
+
"11-8": ["记者节"],
|
|
174
|
+
"11-9": ["全国消防日"],
|
|
175
|
+
"11-11": ["光棍节"],
|
|
176
|
+
"11-12": ["孙中山诞辰纪念日"],
|
|
177
|
+
"11-14": ["电影情人节"],
|
|
178
|
+
"11-16": ["国际宽容日"],
|
|
179
|
+
"11-17": ["国际大学生节"],
|
|
180
|
+
"11-19": ["世界厕所日"],
|
|
181
|
+
"11-28": ["恩格斯诞辰纪念日"],
|
|
182
|
+
"11-29": ["国际声援巴勒斯坦人民日"],
|
|
183
|
+
"12-1": ["世界艾滋病日"],
|
|
184
|
+
"12-2": ["全国交通安全日"],
|
|
185
|
+
"12-3": ["世界残疾人日"],
|
|
186
|
+
"12-4": ["全国法制宣传日"],
|
|
187
|
+
"12-5": ["世界弱能人士日", "国际志愿人员日"],
|
|
188
|
+
"12-7": ["国际民航日"],
|
|
189
|
+
"12-9": ["世界足球日", "国际反腐败日"],
|
|
190
|
+
"12-10": ["世界人权日"],
|
|
191
|
+
"12-11": ["国际山岳日"],
|
|
192
|
+
"12-12": ["西安事变纪念日"],
|
|
193
|
+
"12-13": ["国家公祭日"],
|
|
194
|
+
"12-14": ["拥抱情人节"],
|
|
195
|
+
"12-18": ["国际移徙者日"],
|
|
196
|
+
"12-26": ["毛泽东诞辰纪念日"]
|
|
197
|
+
};
|
|
198
|
+
static WEEK_FESTIVAL = {
|
|
199
|
+
"3-0-1": "全国中小学生安全教育日",
|
|
200
|
+
"5-2-0": "母亲节",
|
|
201
|
+
"5-3-0": "全国助残日",
|
|
202
|
+
"6-3-0": "父亲节",
|
|
203
|
+
"9-3-6": "全民国防教育日",
|
|
204
|
+
"10-1-1": "世界住房日",
|
|
205
|
+
"11-4-4": "感恩节"
|
|
206
|
+
};
|
|
207
|
+
static isLeapYear(e) {
|
|
208
|
+
return e < 1600 ? e % 4 === 0 : e % 4 === 0 && e % 100 !== 0 || e % 400 === 0;
|
|
209
|
+
}
|
|
210
|
+
static getDaysOfMonth(e, n) {
|
|
211
|
+
if (e === 1582 && n === 10)
|
|
212
|
+
return 21;
|
|
213
|
+
const s = n - 1;
|
|
214
|
+
let r = t.DAYS_OF_MONTH[s];
|
|
215
|
+
return s === 1 && t.isLeapYear(e) && r++, r;
|
|
216
|
+
}
|
|
217
|
+
static getDaysOfYear(e) {
|
|
218
|
+
return e === 1582 ? 355 : t.isLeapYear(e) ? 366 : 365;
|
|
219
|
+
}
|
|
220
|
+
static getDaysInYear(e, n, s) {
|
|
221
|
+
let r = 0;
|
|
222
|
+
for (let g = 1; g < n; g++)
|
|
223
|
+
r += t.getDaysOfMonth(e, g);
|
|
224
|
+
let f = s;
|
|
225
|
+
if (e === 1582 && n === 10 && s >= 15) {
|
|
226
|
+
if (s >= 15)
|
|
227
|
+
f -= 10;
|
|
228
|
+
else if (s > 4)
|
|
229
|
+
throw new Error(`wrong solar year ${e} month ${n} day ${s}`);
|
|
230
|
+
}
|
|
231
|
+
return r += f, r;
|
|
232
|
+
}
|
|
233
|
+
static getWeeksOfMonth(e, n, s) {
|
|
234
|
+
return Math.ceil(
|
|
235
|
+
(t.getDaysOfMonth(e, n) + c.fromYmd(e, n, 1).getWeek() - s) / 7
|
|
236
|
+
);
|
|
237
|
+
}
|
|
238
|
+
static getDaysBetween(e, n, s, r, f, g) {
|
|
239
|
+
let u, i, a;
|
|
240
|
+
if (e == r)
|
|
241
|
+
u = t.getDaysInYear(r, f, g) - t.getDaysInYear(e, n, s);
|
|
242
|
+
else if (e > r) {
|
|
243
|
+
for (i = t.getDaysOfYear(r) - t.getDaysInYear(r, f, g), a = r + 1; a < e; a++)
|
|
244
|
+
i += t.getDaysOfYear(a);
|
|
245
|
+
i += t.getDaysInYear(e, n, s), u = -i;
|
|
246
|
+
} else {
|
|
247
|
+
for (i = t.getDaysOfYear(e) - t.getDaysInYear(e, n, s), a = e + 1; a < r; a++)
|
|
248
|
+
i += t.getDaysOfYear(a);
|
|
249
|
+
i += t.getDaysInYear(r, f, g), u = i;
|
|
250
|
+
}
|
|
251
|
+
return u;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
export {
|
|
255
|
+
t as SolarUtil
|
|
256
|
+
};
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { Solar as o } from "./Solar.js";
|
|
2
|
+
import { SolarUtil as y } from "./SolarUtil.js";
|
|
3
|
+
class h {
|
|
4
|
+
_year;
|
|
5
|
+
_month;
|
|
6
|
+
_day;
|
|
7
|
+
_start;
|
|
8
|
+
static fromYmd(t, s, e, r) {
|
|
9
|
+
return new h(t, s, e, r);
|
|
10
|
+
}
|
|
11
|
+
static fromDate(t, s) {
|
|
12
|
+
return h.fromYmd(
|
|
13
|
+
t.getFullYear(),
|
|
14
|
+
t.getMonth() + 1,
|
|
15
|
+
t.getDate(),
|
|
16
|
+
s
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
constructor(t, s, e, r) {
|
|
20
|
+
this._year = t, this._month = s, this._day = e, this._start = r;
|
|
21
|
+
}
|
|
22
|
+
getYear() {
|
|
23
|
+
return this._year;
|
|
24
|
+
}
|
|
25
|
+
getMonth() {
|
|
26
|
+
return this._month;
|
|
27
|
+
}
|
|
28
|
+
getDay() {
|
|
29
|
+
return this._day;
|
|
30
|
+
}
|
|
31
|
+
getStart() {
|
|
32
|
+
return this._start;
|
|
33
|
+
}
|
|
34
|
+
getIndex() {
|
|
35
|
+
let t = o.fromYmd(this._year, this._month, 1).getWeek() - this._start;
|
|
36
|
+
return t < 0 && (t += 7), Math.ceil((this._day + t) / 7);
|
|
37
|
+
}
|
|
38
|
+
getIndexInYear() {
|
|
39
|
+
let t = o.fromYmd(this._year, 1, 1).getWeek() - this._start;
|
|
40
|
+
return t < 0 && (t += 7), Math.ceil(
|
|
41
|
+
(y.getDaysInYear(this._year, this._month, this._day) + t) / 7
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
next(t, s) {
|
|
45
|
+
const e = this._start;
|
|
46
|
+
if (t === 0)
|
|
47
|
+
return h.fromYmd(this._year, this._month, this._day, e);
|
|
48
|
+
let r = o.fromYmd(this._year, this._month, this._day);
|
|
49
|
+
if (s) {
|
|
50
|
+
let g = t, n = h.fromYmd(this._year, this._month, this._day, e), f = this._month;
|
|
51
|
+
const m = g > 0;
|
|
52
|
+
for (; g !== 0; ) {
|
|
53
|
+
r = r.next(m ? 7 : -7), n = h.fromYmd(
|
|
54
|
+
r.getYear(),
|
|
55
|
+
r.getMonth(),
|
|
56
|
+
r.getDay(),
|
|
57
|
+
e
|
|
58
|
+
);
|
|
59
|
+
let a = n.getMonth();
|
|
60
|
+
if (f !== a) {
|
|
61
|
+
const d = n.getIndex();
|
|
62
|
+
if (m)
|
|
63
|
+
if (d === 1) {
|
|
64
|
+
const i = n.getFirstDay();
|
|
65
|
+
n = h.fromYmd(
|
|
66
|
+
i.getYear(),
|
|
67
|
+
i.getMonth(),
|
|
68
|
+
i.getDay(),
|
|
69
|
+
e
|
|
70
|
+
), a = n.getMonth();
|
|
71
|
+
} else
|
|
72
|
+
r = o.fromYmd(n.getYear(), n.getMonth(), 1), n = h.fromYmd(
|
|
73
|
+
r.getYear(),
|
|
74
|
+
r.getMonth(),
|
|
75
|
+
r.getDay(),
|
|
76
|
+
e
|
|
77
|
+
);
|
|
78
|
+
else if (y.getWeeksOfMonth(
|
|
79
|
+
n.getYear(),
|
|
80
|
+
n.getMonth(),
|
|
81
|
+
e
|
|
82
|
+
) === d) {
|
|
83
|
+
const i = n.getFirstDay().next(6);
|
|
84
|
+
n = h.fromYmd(
|
|
85
|
+
i.getYear(),
|
|
86
|
+
i.getMonth(),
|
|
87
|
+
i.getDay(),
|
|
88
|
+
e
|
|
89
|
+
), a = n.getMonth();
|
|
90
|
+
} else
|
|
91
|
+
r = o.fromYmd(
|
|
92
|
+
n.getYear(),
|
|
93
|
+
n.getMonth(),
|
|
94
|
+
y.getDaysOfMonth(n.getYear(), n.getMonth())
|
|
95
|
+
), n = h.fromYmd(
|
|
96
|
+
r.getYear(),
|
|
97
|
+
r.getMonth(),
|
|
98
|
+
r.getDay(),
|
|
99
|
+
e
|
|
100
|
+
);
|
|
101
|
+
f = a;
|
|
102
|
+
}
|
|
103
|
+
g -= m ? 1 : -1;
|
|
104
|
+
}
|
|
105
|
+
return n;
|
|
106
|
+
} else
|
|
107
|
+
return r = r.next(t * 7), h.fromYmd(
|
|
108
|
+
r.getYear(),
|
|
109
|
+
r.getMonth(),
|
|
110
|
+
r.getDay(),
|
|
111
|
+
e
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
getFirstDay() {
|
|
115
|
+
const t = o.fromYmd(this._year, this._month, this._day);
|
|
116
|
+
let s = t.getWeek() - this._start;
|
|
117
|
+
return s < 0 && (s += 7), t.next(-s);
|
|
118
|
+
}
|
|
119
|
+
getFirstDayInMonth() {
|
|
120
|
+
let t = 0;
|
|
121
|
+
const s = this.getDays();
|
|
122
|
+
for (let e = 0; e < s.length; e++)
|
|
123
|
+
if (this._month === s[e].getMonth()) {
|
|
124
|
+
t = e;
|
|
125
|
+
break;
|
|
126
|
+
}
|
|
127
|
+
return s[t];
|
|
128
|
+
}
|
|
129
|
+
getDays() {
|
|
130
|
+
const t = this.getFirstDay(), s = [];
|
|
131
|
+
s.push(t);
|
|
132
|
+
for (let e = 1; e < 7; e++)
|
|
133
|
+
s.push(t.next(e));
|
|
134
|
+
return s;
|
|
135
|
+
}
|
|
136
|
+
getDaysInMonth() {
|
|
137
|
+
const t = this.getDays(), s = [];
|
|
138
|
+
for (let e = 0; e < t.length; e++) {
|
|
139
|
+
const r = t[e];
|
|
140
|
+
this._month === r.getMonth() && s.push(r);
|
|
141
|
+
}
|
|
142
|
+
return s;
|
|
143
|
+
}
|
|
144
|
+
toString() {
|
|
145
|
+
return `${this.getYear()}.${this.getMonth()}.${this.getIndex()}`;
|
|
146
|
+
}
|
|
147
|
+
toFullString() {
|
|
148
|
+
return `${this.getYear()}年${this.getMonth()}月第${this.getIndex()}周`;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
export {
|
|
152
|
+
h as SolarWeek
|
|
153
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { SolarMonth as o } from "./SolarMonth.js";
|
|
2
|
+
class r {
|
|
3
|
+
_year;
|
|
4
|
+
static fromYear(t) {
|
|
5
|
+
return new r(t);
|
|
6
|
+
}
|
|
7
|
+
static fromDate(t) {
|
|
8
|
+
return r.fromYear(t.getFullYear());
|
|
9
|
+
}
|
|
10
|
+
constructor(t) {
|
|
11
|
+
this._year = t;
|
|
12
|
+
}
|
|
13
|
+
getYear() {
|
|
14
|
+
return this._year;
|
|
15
|
+
}
|
|
16
|
+
next(t) {
|
|
17
|
+
return r.fromYear(this._year + t);
|
|
18
|
+
}
|
|
19
|
+
getMonths() {
|
|
20
|
+
const t = [], n = o.fromYm(this._year, 1);
|
|
21
|
+
t.push(n);
|
|
22
|
+
for (let e = 1; e < 12; e++)
|
|
23
|
+
t.push(n.next(e));
|
|
24
|
+
return t;
|
|
25
|
+
}
|
|
26
|
+
toString() {
|
|
27
|
+
return `${this.getYear()}`;
|
|
28
|
+
}
|
|
29
|
+
toFullString() {
|
|
30
|
+
return `${this.getYear()}年`;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
export {
|
|
34
|
+
r as SolarYear
|
|
35
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Holiday as a } from "./Holiday.js";
|
|
2
|
+
import { HolidayUtil as f } from "./HolidayUtil.js";
|
|
3
|
+
import { JieQi as x } from "./JieQi.js";
|
|
4
|
+
import { Lunar as i } from "./Lunar.js";
|
|
5
|
+
import { LunarUtil as S } from "./LunarUtil.js";
|
|
6
|
+
import { Solar as L } from "./Solar.js";
|
|
7
|
+
import { SolarUtil as U } from "./SolarUtil.js";
|
|
8
|
+
import { SolarHalfYear as d } from "./SolarHalfYear.js";
|
|
9
|
+
import { SolarMonth as y } from "./SolarMonth.js";
|
|
10
|
+
import { SolarSeason as k } from "./SolarSeason.js";
|
|
11
|
+
import { SolarWeek as I } from "./SolarWeek.js";
|
|
12
|
+
import { SolarYear as Q } from "./SolarYear.js";
|
|
13
|
+
import { I18n as r } from "./I18n.js";
|
|
14
|
+
import { LunarMonth as W } from "./LunarMonth.js";
|
|
15
|
+
import { LunarTime as c } from "./LunarTime.js";
|
|
16
|
+
import { LunarYear as j } from "./LunarYear.js";
|
|
17
|
+
r.init();
|
|
18
|
+
export {
|
|
19
|
+
a as Holiday,
|
|
20
|
+
f as HolidayUtil,
|
|
21
|
+
r as I18n,
|
|
22
|
+
x as JieQi,
|
|
23
|
+
i as Lunar,
|
|
24
|
+
W as LunarMonth,
|
|
25
|
+
c as LunarTime,
|
|
26
|
+
S as LunarUtil,
|
|
27
|
+
j as LunarYear,
|
|
28
|
+
L as Solar,
|
|
29
|
+
d as SolarHalfYear,
|
|
30
|
+
y as SolarMonth,
|
|
31
|
+
k as SolarSeason,
|
|
32
|
+
U as SolarUtil,
|
|
33
|
+
I as SolarWeek,
|
|
34
|
+
Q as SolarYear
|
|
35
|
+
};
|
package/lunar.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as r from "./lunar/lib/index.js";
|
|
2
|
+
import { Holiday as t } from "./lunar/lib/Holiday.js";
|
|
3
|
+
import { HolidayUtil as f } from "./lunar/lib/HolidayUtil.js";
|
|
4
|
+
import { I18n as p } from "./lunar/lib/I18n.js";
|
|
5
|
+
import { JieQi as l } from "./lunar/lib/JieQi.js";
|
|
6
|
+
import { Lunar as n } from "./lunar/lib/Lunar.js";
|
|
7
|
+
import { LunarMonth as u } from "./lunar/lib/LunarMonth.js";
|
|
8
|
+
import { LunarTime as d } from "./lunar/lib/LunarTime.js";
|
|
9
|
+
import { LunarUtil as H } from "./lunar/lib/LunarUtil.js";
|
|
10
|
+
import { LunarYear as Y } from "./lunar/lib/LunarYear.js";
|
|
11
|
+
import { Solar as y } from "./lunar/lib/Solar.js";
|
|
12
|
+
import { SolarHalfYear as k } from "./lunar/lib/SolarHalfYear.js";
|
|
13
|
+
import { SolarMonth as J } from "./lunar/lib/SolarMonth.js";
|
|
14
|
+
import { SolarSeason as T } from "./lunar/lib/SolarSeason.js";
|
|
15
|
+
import { SolarUtil as b } from "./lunar/lib/SolarUtil.js";
|
|
16
|
+
import { SolarWeek as g } from "./lunar/lib/SolarWeek.js";
|
|
17
|
+
import { SolarYear as q } from "./lunar/lib/SolarYear.js";
|
|
18
|
+
export {
|
|
19
|
+
t as Holiday,
|
|
20
|
+
f as HolidayUtil,
|
|
21
|
+
p as I18n,
|
|
22
|
+
l as JieQi,
|
|
23
|
+
n as Lunar,
|
|
24
|
+
u as LunarMonth,
|
|
25
|
+
d as LunarTime,
|
|
26
|
+
H as LunarUtil,
|
|
27
|
+
Y as LunarYear,
|
|
28
|
+
y as Solar,
|
|
29
|
+
k as SolarHalfYear,
|
|
30
|
+
J as SolarMonth,
|
|
31
|
+
T as SolarSeason,
|
|
32
|
+
b as SolarUtil,
|
|
33
|
+
g as SolarWeek,
|
|
34
|
+
q as SolarYear,
|
|
35
|
+
r as default
|
|
36
|
+
};
|
package/math.js
ADDED
package/md5.js
ADDED
package/mock.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { MockWebSocket as o, WebSocketNative as c } from "./mock/MockWebSocket.js";
|
|
2
|
+
import { MockXMLHttpRequest as p, XMLHttpRequestNative as r } from "./mock/MockXMLHttpRequest.js";
|
|
3
|
+
export {
|
|
4
|
+
o as MockWebSocket,
|
|
5
|
+
p as MockXMLHttpRequest,
|
|
6
|
+
c as WebSocketNative,
|
|
7
|
+
r as XMLHttpRequestNative
|
|
8
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
const h = (i) => {
|
|
2
|
+
const t = {
|
|
3
|
+
normal: {
|
|
4
|
+
digits: ["零", "一", "二", "三", "四", "五", "六", "七", "八", "九"],
|
|
5
|
+
units: ["", "十", "百", "千"],
|
|
6
|
+
bigUnits: ["", "万", "亿", "万亿"],
|
|
7
|
+
decimalUnits: ["点"]
|
|
8
|
+
// 普通模式小数单位
|
|
9
|
+
},
|
|
10
|
+
money: {
|
|
11
|
+
digits: ["零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖"],
|
|
12
|
+
units: ["", "拾", "佰", "仟"],
|
|
13
|
+
bigUnits: ["", "万", "亿", "万亿"],
|
|
14
|
+
decimalUnits: ["元", "角", "分", "厘"],
|
|
15
|
+
// 金额模式小数单位
|
|
16
|
+
suffix: "整"
|
|
17
|
+
// 金额后缀
|
|
18
|
+
}
|
|
19
|
+
}[i.mode], d = (r) => {
|
|
20
|
+
let s = "";
|
|
21
|
+
const l = Math.floor(r).toString(), n = [];
|
|
22
|
+
for (let e = l.length; e > 0; e -= 4)
|
|
23
|
+
n.push(l.slice(Math.max(0, e - 4), e));
|
|
24
|
+
return n.forEach((e, c) => {
|
|
25
|
+
let a = "", o = !1;
|
|
26
|
+
for (let g = 0; g < e.length; g++) {
|
|
27
|
+
const m = parseInt(e[g]), u = e.length - 1 - g;
|
|
28
|
+
m === 0 ? o = !0 : (o && (a += t.digits[0], o = !1), a += t.digits[m] + t.units[u]);
|
|
29
|
+
}
|
|
30
|
+
a !== "" && (a += t.bigUnits[c], s = a + s);
|
|
31
|
+
}), i.mode === "money" && s && (s += t.decimalUnits[0]), s;
|
|
32
|
+
}, f = (r) => {
|
|
33
|
+
if (r <= 0) return "";
|
|
34
|
+
let s = r.toString().padStart(i.decimalDigits, "0").substring(0, i.decimalDigits);
|
|
35
|
+
i.trailingZeros || (s = s.replace(/0+$/, ""));
|
|
36
|
+
let l = "";
|
|
37
|
+
for (let n = 0; n < s.length; n++) {
|
|
38
|
+
const e = parseInt(s[n]);
|
|
39
|
+
e !== 0 && (l += t.digits[e] + (t.decimalUnits[n + 1] || ""));
|
|
40
|
+
}
|
|
41
|
+
return l;
|
|
42
|
+
};
|
|
43
|
+
return (r) => {
|
|
44
|
+
if (isNaN(r)) return "无效数字";
|
|
45
|
+
if (r === 0)
|
|
46
|
+
return i.mode === "money" ? t.digits[0] + t.decimalUnits[0] + t.suffix : t.digits[0];
|
|
47
|
+
let s = "";
|
|
48
|
+
r < 0 && (s = i.negativeSymbol, r = Math.abs(r));
|
|
49
|
+
const l = Math.floor(r), n = Math.round(
|
|
50
|
+
(r - l) * Math.pow(10, i.decimalDigits)
|
|
51
|
+
);
|
|
52
|
+
let e = s;
|
|
53
|
+
const c = d(l), a = f(n);
|
|
54
|
+
return e += c, c === "" && i.mode === "money" && (e += t.digits[0] + t.decimalUnits[0]), e += a, i.mode === "money" && a === "" && c && (e += t.suffix), i.mode === "normal" ? e.startsWith(t.digits[1] + t.units[1]) && (e = e.substring(1)) : e = e.replace(/(零[仟佰拾])+/g, "零").replace(/零+/g, "零").replace(
|
|
55
|
+
new RegExp(`${t.digits[0]}${t.decimalUnits[0]}`),
|
|
56
|
+
t.decimalUnits[0]
|
|
57
|
+
), e || t.digits[0];
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
function U(i, t = {}) {
|
|
61
|
+
const d = {
|
|
62
|
+
mode: "normal",
|
|
63
|
+
negativeSymbol: "负",
|
|
64
|
+
decimalDigits: 4,
|
|
65
|
+
trailingZeros: !1,
|
|
66
|
+
...t
|
|
67
|
+
};
|
|
68
|
+
return h(d)(i);
|
|
69
|
+
}
|
|
70
|
+
export {
|
|
71
|
+
U as default
|
|
72
|
+
};
|
package/nzh.js
ADDED
package/objectKeysSort.js
CHANGED
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@unicom-cloud/utils","version":"0.1.
|
|
1
|
+
{"name":"@unicom-cloud/utils","version":"0.1.12","dependencies":{},"peerDependencies":{"lodash":"^4.17.21"},"main":"./index.js","type":"module","types":"types/index.d.ts","publishConfig":{"registry":"https://registry.npmjs.org/","access":"public"}}
|
package/random.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import "lodash/sample";
|
|
2
|
+
import "uuid";
|
|
3
|
+
import "./random/address.js";
|
|
4
|
+
import "./random/constellation.js";
|
|
5
|
+
import "./random/image.js";
|
|
6
|
+
import "./random/licensePlate.js";
|
|
7
|
+
import "./random/name.js";
|
|
8
|
+
import "./random/number.js";
|
|
9
|
+
import "./random/text.js";
|
|
10
|
+
import "./random/time.js";
|
|
11
|
+
import "./random/web.js";
|
|
12
|
+
import { default as b } from "./random/index.js";
|
|
13
|
+
export {
|
|
14
|
+
b as default
|
|
15
|
+
};
|
package/screenfull.js
ADDED