xjs-common 11.0.2 → 12.0.0-alpha.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/LICENSE +201 -201
- package/build/const/types.d.ts +45 -1
- package/build/func/decorator/d-type.d.ts +24 -2
- package/build/func/decorator/d-type.js +19 -15
- package/build/func/u-array.d.ts +12 -13
- package/build/func/u-array.js +12 -1
- package/build/func/u-obj.d.ts +16 -2
- package/build/func/u-obj.js +29 -1
- package/build/func/u-type.d.ts +1 -0
- package/build/func/u-type.js +9 -2
- package/build/func/u.d.ts +22 -7
- package/build/index.d.ts +0 -2
- package/build/index.js +0 -2
- package/package.json +1 -1
- package/build/const/ccy.d.ts +0 -18
- package/build/const/ccy.js +0 -16
- package/build/const/gender.d.ts +0 -4
- package/build/const/gender.js +0 -5
package/LICENSE
CHANGED
|
@@ -1,202 +1,202 @@
|
|
|
1
|
-
|
|
2
|
-
Apache License
|
|
3
|
-
Version 2.0, January 2004
|
|
4
|
-
http://www.apache.org/licenses/
|
|
5
|
-
|
|
6
|
-
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
-
|
|
8
|
-
1. Definitions.
|
|
9
|
-
|
|
10
|
-
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
-
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
-
|
|
13
|
-
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
-
the copyright owner that is granting the License.
|
|
15
|
-
|
|
16
|
-
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
-
other entities that control, are controlled by, or are under common
|
|
18
|
-
control with that entity. For the purposes of this definition,
|
|
19
|
-
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
-
direction or management of such entity, whether by contract or
|
|
21
|
-
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
-
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
-
|
|
24
|
-
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
-
exercising permissions granted by this License.
|
|
26
|
-
|
|
27
|
-
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
-
including but not limited to software source code, documentation
|
|
29
|
-
source, and configuration files.
|
|
30
|
-
|
|
31
|
-
"Object" form shall mean any form resulting from mechanical
|
|
32
|
-
transformation or translation of a Source form, including but
|
|
33
|
-
not limited to compiled object code, generated documentation,
|
|
34
|
-
and conversions to other media types.
|
|
35
|
-
|
|
36
|
-
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
-
Object form, made available under the License, as indicated by a
|
|
38
|
-
copyright notice that is included in or attached to the work
|
|
39
|
-
(an example is provided in the Appendix below).
|
|
40
|
-
|
|
41
|
-
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
-
form, that is based on (or derived from) the Work and for which the
|
|
43
|
-
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
-
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
-
of this License, Derivative Works shall not include works that remain
|
|
46
|
-
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
-
the Work and Derivative Works thereof.
|
|
48
|
-
|
|
49
|
-
"Contribution" shall mean any work of authorship, including
|
|
50
|
-
the original version of the Work and any modifications or additions
|
|
51
|
-
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
-
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
-
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
-
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
-
means any form of electronic, verbal, or written communication sent
|
|
56
|
-
to the Licensor or its representatives, including but not limited to
|
|
57
|
-
communication on electronic mailing lists, source code control systems,
|
|
58
|
-
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
-
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
-
excluding communication that is conspicuously marked or otherwise
|
|
61
|
-
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
-
|
|
63
|
-
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
-
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
-
subsequently incorporated within the Work.
|
|
66
|
-
|
|
67
|
-
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
-
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
-
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
-
Work and such Derivative Works in Source or Object form.
|
|
73
|
-
|
|
74
|
-
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
-
(except as stated in this section) patent license to make, have made,
|
|
78
|
-
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
-
where such license applies only to those patent claims licensable
|
|
80
|
-
by such Contributor that are necessarily infringed by their
|
|
81
|
-
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
-
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
-
institute patent litigation against any entity (including a
|
|
84
|
-
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
-
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
-
or contributory patent infringement, then any patent licenses
|
|
87
|
-
granted to You under this License for that Work shall terminate
|
|
88
|
-
as of the date such litigation is filed.
|
|
89
|
-
|
|
90
|
-
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
-
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
-
modifications, and in Source or Object form, provided that You
|
|
93
|
-
meet the following conditions:
|
|
94
|
-
|
|
95
|
-
(a) You must give any other recipients of the Work or
|
|
96
|
-
Derivative Works a copy of this License; and
|
|
97
|
-
|
|
98
|
-
(b) You must cause any modified files to carry prominent notices
|
|
99
|
-
stating that You changed the files; and
|
|
100
|
-
|
|
101
|
-
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
-
that You distribute, all copyright, patent, trademark, and
|
|
103
|
-
attribution notices from the Source form of the Work,
|
|
104
|
-
excluding those notices that do not pertain to any part of
|
|
105
|
-
the Derivative Works; and
|
|
106
|
-
|
|
107
|
-
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
-
distribution, then any Derivative Works that You distribute must
|
|
109
|
-
include a readable copy of the attribution notices contained
|
|
110
|
-
within such NOTICE file, excluding those notices that do not
|
|
111
|
-
pertain to any part of the Derivative Works, in at least one
|
|
112
|
-
of the following places: within a NOTICE text file distributed
|
|
113
|
-
as part of the Derivative Works; within the Source form or
|
|
114
|
-
documentation, if provided along with the Derivative Works; or,
|
|
115
|
-
within a display generated by the Derivative Works, if and
|
|
116
|
-
wherever such third-party notices normally appear. The contents
|
|
117
|
-
of the NOTICE file are for informational purposes only and
|
|
118
|
-
do not modify the License. You may add Your own attribution
|
|
119
|
-
notices within Derivative Works that You distribute, alongside
|
|
120
|
-
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
-
that such additional attribution notices cannot be construed
|
|
122
|
-
as modifying the License.
|
|
123
|
-
|
|
124
|
-
You may add Your own copyright statement to Your modifications and
|
|
125
|
-
may provide additional or different license terms and conditions
|
|
126
|
-
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
-
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
-
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
-
the conditions stated in this License.
|
|
130
|
-
|
|
131
|
-
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
-
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
-
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
-
this License, without any additional terms or conditions.
|
|
135
|
-
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
-
the terms of any separate license agreement you may have executed
|
|
137
|
-
with Licensor regarding such Contributions.
|
|
138
|
-
|
|
139
|
-
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
-
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
-
except as required for reasonable and customary use in describing the
|
|
142
|
-
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
-
|
|
144
|
-
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
-
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
-
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
-
implied, including, without limitation, any warranties or conditions
|
|
149
|
-
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
-
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
-
appropriateness of using or redistributing the Work and assume any
|
|
152
|
-
risks associated with Your exercise of permissions under this License.
|
|
153
|
-
|
|
154
|
-
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
-
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
-
unless required by applicable law (such as deliberate and grossly
|
|
157
|
-
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
-
liable to You for damages, including any direct, indirect, special,
|
|
159
|
-
incidental, or consequential damages of any character arising as a
|
|
160
|
-
result of this License or out of the use or inability to use the
|
|
161
|
-
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
-
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
-
other commercial damages or losses), even if such Contributor
|
|
164
|
-
has been advised of the possibility of such damages.
|
|
165
|
-
|
|
166
|
-
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
-
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
-
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
-
or other liability obligations and/or rights consistent with this
|
|
170
|
-
License. However, in accepting such obligations, You may act only
|
|
171
|
-
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
-
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
-
defend, and hold each Contributor harmless for any liability
|
|
174
|
-
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
-
of your accepting any such warranty or additional liability.
|
|
176
|
-
|
|
177
|
-
END OF TERMS AND CONDITIONS
|
|
178
|
-
|
|
179
|
-
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
-
|
|
181
|
-
To apply the Apache License to your work, attach the following
|
|
182
|
-
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
-
replaced with your own identifying information. (Don't include
|
|
184
|
-
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
-
comment syntax for the file format. We also recommend that a
|
|
186
|
-
file or class name and description of purpose be included on the
|
|
187
|
-
same "printed page" as the copyright notice for easier
|
|
188
|
-
identification within third-party archives.
|
|
189
|
-
|
|
190
|
-
Copyright 2025 begyyal
|
|
191
|
-
|
|
192
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
-
you may not use this file except in compliance with the License.
|
|
194
|
-
You may obtain a copy of the License at
|
|
195
|
-
|
|
196
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
-
|
|
198
|
-
Unless required by applicable law or agreed to in writing, software
|
|
199
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
-
See the License for the specific language governing permissions and
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright 2025 begyyal
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
202
|
limitations under the License.
|
package/build/const/types.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export type IndexSignature = string | number | symbol;
|
|
2
2
|
export type NormalRecord<T = any> = Record<IndexSignature, T>;
|
|
3
|
-
export type MaybeArray<T> = T | T[];
|
|
3
|
+
export type MaybeArray<T = any> = T | T[];
|
|
4
|
+
export type MaybePromise<T = any> = T | Promise<T>;
|
|
4
5
|
export type Loggable = {
|
|
5
6
|
log: (msg: any) => void;
|
|
6
7
|
warn: (msg: any) => void;
|
|
@@ -12,6 +13,43 @@ export type Unique<T = number> = {
|
|
|
12
13
|
export type IdName<T = number> = {
|
|
13
14
|
name: string;
|
|
14
15
|
} & Unique<T>;
|
|
16
|
+
export type Any = string | number | bigint | boolean | symbol | object | undefined | null;
|
|
17
|
+
export interface AlmostArray<E = any> extends ArrayLike<E> {
|
|
18
|
+
/** {@link Array.copyWithin()} */
|
|
19
|
+
copyWithin(target: number, start: number, end?: number): this;
|
|
20
|
+
/** {@link Array.every()} */
|
|
21
|
+
every(predicate: (value: E, index: number, array: this) => unknown, thisArg?: any): boolean;
|
|
22
|
+
/** {@link Array.fill()} */
|
|
23
|
+
fill(value: E, start?: number, end?: number): this;
|
|
24
|
+
/** {@link Array.filter()} */
|
|
25
|
+
filter(predicate: (value: E, index: number, array: this) => any, thisArg?: any): this;
|
|
26
|
+
/** {@link Array.find()} */
|
|
27
|
+
find(predicate: (value: E, index: number, obj: this) => boolean, thisArg?: any): E | undefined;
|
|
28
|
+
/** {@link Array.findIndex()} */
|
|
29
|
+
findIndex(predicate: (value: E, index: number, obj: this) => boolean, thisArg?: any): number;
|
|
30
|
+
/** {@link Array.forEach()} */
|
|
31
|
+
forEach(callbackfn: (value: E, index: number, array: this) => void, thisArg?: any): void;
|
|
32
|
+
/** {@link Array.indexOf()} */
|
|
33
|
+
indexOf(searchElement: E, fromIndex?: number): number;
|
|
34
|
+
/** {@link Array.join()} */
|
|
35
|
+
join(separator?: string): string;
|
|
36
|
+
/** {@link Array.lastIndexOf()} */
|
|
37
|
+
lastIndexOf(searchElement: E, fromIndex?: number): number;
|
|
38
|
+
/** {@link Array.map()} */
|
|
39
|
+
map(callbackfn: (value: E, index: number, array: this) => number, thisArg?: any): this;
|
|
40
|
+
/** {@link Array.reduce()} */
|
|
41
|
+
reduce<U = E>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: this) => U, initialValue?: U): U;
|
|
42
|
+
/** {@link Array.reduceRight()} */
|
|
43
|
+
reduceRight<U = E>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: this) => U, initialValue?: U): U;
|
|
44
|
+
/** {@link Array.reverse()} */
|
|
45
|
+
reverse(): this;
|
|
46
|
+
/** {@link Array.slice()} */
|
|
47
|
+
slice(start?: number, end?: number): this;
|
|
48
|
+
/** {@link Array.some()} */
|
|
49
|
+
some(predicate: (value: E, index: number, array: this) => unknown, thisArg?: any): boolean;
|
|
50
|
+
/** {@link Array.sort()} */
|
|
51
|
+
sort(compareFn?: (a: E, b: E) => number): this;
|
|
52
|
+
}
|
|
15
53
|
export declare enum Type {
|
|
16
54
|
string = "string",
|
|
17
55
|
number = "number",
|
|
@@ -22,3 +60,9 @@ export declare enum Type {
|
|
|
22
60
|
undefined = "undefined",
|
|
23
61
|
null = "null"
|
|
24
62
|
}
|
|
63
|
+
export type NonString = Exclude<Any, string>;
|
|
64
|
+
export type NonNumber = Exclude<Any, number>;
|
|
65
|
+
export type NonBigint = Exclude<Any, bigint>;
|
|
66
|
+
export type NonBoolean = Exclude<Any, boolean>;
|
|
67
|
+
export type NonSymbol = Exclude<Any, symbol>;
|
|
68
|
+
export type NonObject = Exclude<Any, object>;
|
|
@@ -1,11 +1,30 @@
|
|
|
1
1
|
import { Type } from "../../const/types";
|
|
2
2
|
export declare const smbl_tm: unique symbol;
|
|
3
|
-
|
|
3
|
+
interface BasicTypeDesc {
|
|
4
4
|
t?: Type;
|
|
5
5
|
req?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface TypeDesc extends BasicTypeDesc {
|
|
6
8
|
ary?: TypeDesc;
|
|
7
9
|
rec?: boolean;
|
|
10
|
+
rcd?: TypeDesc;
|
|
8
11
|
}
|
|
12
|
+
type ArrayTypeDesc = TypeDesc & {
|
|
13
|
+
t?: never;
|
|
14
|
+
rec?: never;
|
|
15
|
+
rcd?: never;
|
|
16
|
+
};
|
|
17
|
+
type ClassTypeDesc = TypeDesc & {
|
|
18
|
+
t?: never;
|
|
19
|
+
ary?: never;
|
|
20
|
+
rcd?: never;
|
|
21
|
+
};
|
|
22
|
+
type RecordTypeDesc = TypeDesc & {
|
|
23
|
+
t?: never;
|
|
24
|
+
arys?: never;
|
|
25
|
+
rec?: never;
|
|
26
|
+
};
|
|
27
|
+
type AnyTypeDesc = BasicTypeDesc | ArrayTypeDesc | ClassTypeDesc | RecordTypeDesc;
|
|
9
28
|
export interface TypeMap {
|
|
10
29
|
[k: string]: TypeDesc;
|
|
11
30
|
}
|
|
@@ -18,7 +37,10 @@ export declare namespace DType {
|
|
|
18
37
|
function number(target: Object, propKey: string): void;
|
|
19
38
|
function boolean(target: Object, propKey: string): void;
|
|
20
39
|
function required(target: Object, propKey: string): void;
|
|
21
|
-
function array(elmDesc?:
|
|
40
|
+
function array(elmDesc?: AnyTypeDesc): (target: Object, propKey: string) => void;
|
|
41
|
+
/** NOTE: this may allow array type because array is essentialy object type has properties. */
|
|
42
|
+
function record(elmDesc?: AnyTypeDesc): (target: Object, propKey: string) => void;
|
|
22
43
|
function recursive(target: Object, propKey: string): void;
|
|
23
44
|
function keep(target: Object, propKey: string): void;
|
|
24
45
|
}
|
|
46
|
+
export {};
|
|
@@ -35,6 +35,11 @@ export var DType;
|
|
|
35
35
|
return (target, propKey) => setDesc(target, propKey, (td) => td.ary = elmDesc);
|
|
36
36
|
}
|
|
37
37
|
DType.array = array;
|
|
38
|
+
/** NOTE: this may allow array type because array is essentialy object type has properties. */
|
|
39
|
+
function record(elmDesc = {}) {
|
|
40
|
+
return (target, propKey) => setDesc(target, propKey, (td) => td.rcd = elmDesc);
|
|
41
|
+
}
|
|
42
|
+
DType.record = record;
|
|
38
43
|
function recursive(target, propKey) {
|
|
39
44
|
setDesc(target, propKey, (td) => td.rec = true);
|
|
40
45
|
}
|
|
@@ -45,24 +50,23 @@ export var DType;
|
|
|
45
50
|
DType.keep = keep;
|
|
46
51
|
function setDesc(target, propKey, setter) {
|
|
47
52
|
const map = target[smbl_tm] ? Object.assign({}, target[smbl_tm]) : {};
|
|
48
|
-
map[propKey] ??= { t: null, req: false, rec: false, ary: null };
|
|
53
|
+
map[propKey] ??= { t: null, req: false, rec: false, ary: null, rcd: null };
|
|
49
54
|
const td = map[propKey];
|
|
50
55
|
setter(td);
|
|
51
|
-
|
|
52
|
-
if (
|
|
53
|
-
ex1 =
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
56
|
+
const structualDescs = [[td.ary, "array"], [td.rec, "recursive flag"], [td.rcd, "record"]].filter(e => e[0]);
|
|
57
|
+
if (structualDescs.length > 0) {
|
|
58
|
+
let ex1 = null, ex2 = null;
|
|
59
|
+
if (td.t) {
|
|
60
|
+
ex1 = "type";
|
|
61
|
+
ex2 = structualDescs[0][1];
|
|
62
|
+
}
|
|
63
|
+
if (structualDescs.length > 1) {
|
|
64
|
+
ex1 = structualDescs[0][1];
|
|
65
|
+
ex2 = structualDescs[1][1];
|
|
66
|
+
}
|
|
67
|
+
if (ex1 && ex2)
|
|
68
|
+
throw new XjsErr(s_errCode, `decorator to express ${ex1} and ${ex2} are exclusive.`);
|
|
63
69
|
}
|
|
64
|
-
if (ex1 && ex2)
|
|
65
|
-
throw new XjsErr(s_errCode, `decorator to express ${ex1} and ${ex2} are exclusive.`);
|
|
66
70
|
Object.defineProperty(target, smbl_tm, { value: map, configurable: true });
|
|
67
71
|
}
|
|
68
72
|
})(DType || (DType = {}));
|
package/build/func/u-array.d.ts
CHANGED
|
@@ -1,24 +1,18 @@
|
|
|
1
|
+
import { AlmostArray } from "../const/types";
|
|
1
2
|
export declare namespace UArray {
|
|
2
3
|
/**
|
|
3
4
|
* compares two arrays to valuate equality.
|
|
4
5
|
* if one side is null or undefined, it returns true when other side is the same.
|
|
6
|
+
* this function has compatibility to `AlmostArray` like `Uint8Array` etc.
|
|
5
7
|
* @param v1 it uses equal operator for comparing elements, so applying object element is not recommended.
|
|
6
8
|
* @param v2 same as v1.
|
|
7
|
-
* @param sort it uses {@link Array
|
|
8
|
-
* @param useStrictEqual it uses `===` operator for compareing elements if true, otherwise using `==` operator. default is true.
|
|
9
|
+
* @param sort it uses {@link Array.sort()} on v1 and v2 if true. default is true.
|
|
10
|
+
* @param useStrictEqual check equality whether `Array` or not and it uses `===` operator for compareing elements if true, otherwise using `==` operator. default is true.
|
|
9
11
|
*/
|
|
10
|
-
function eq(v1: any[], v2: any[], op
|
|
12
|
+
function eq(v1: any[] | AlmostArray, v2: any[] | AlmostArray, op?: {
|
|
11
13
|
sort?: boolean;
|
|
12
|
-
useStrictEqual
|
|
14
|
+
useStrictEqual?: boolean;
|
|
13
15
|
}): boolean;
|
|
14
|
-
function eq<T>(v1: T[], v2: T[], op: {
|
|
15
|
-
sort?: boolean;
|
|
16
|
-
useStrictEqual: true;
|
|
17
|
-
}): boolean;
|
|
18
|
-
function eq<T>(v1: T[], v2: T[], op: {
|
|
19
|
-
sort?: boolean;
|
|
20
|
-
}): boolean;
|
|
21
|
-
function eq<T>(v1: T[], v2: T[]): boolean;
|
|
22
16
|
/**
|
|
23
17
|
* returns array which is removed duplicate of elements.
|
|
24
18
|
* this doesn't mutate the param.
|
|
@@ -32,7 +26,12 @@ export declare namespace UArray {
|
|
|
32
26
|
predicate: (v1: T, v2: T) => boolean;
|
|
33
27
|
takeLast?: boolean;
|
|
34
28
|
}): T[];
|
|
35
|
-
|
|
29
|
+
/**
|
|
30
|
+
* chop array to partial arrays which have specified length. the remainder is added to end of a result.
|
|
31
|
+
* this function has compatibility to `AlmostArray` like `Uint8Array` etc.
|
|
32
|
+
*/
|
|
33
|
+
function chop<E>(array: E[], len: number): E[][];
|
|
34
|
+
function chop<T extends AlmostArray>(array: T, len: number): T[];
|
|
36
35
|
function remove<T>(array: T[], v: T): void;
|
|
37
36
|
function randomPick<T>(array: T[], takeout?: boolean): T;
|
|
38
37
|
function shuffle<T>(array: T[]): T[];
|
package/build/func/u-array.js
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import { array2map, int2array } from "./u";
|
|
2
2
|
export var UArray;
|
|
3
3
|
(function (UArray) {
|
|
4
|
+
/**
|
|
5
|
+
* compares two arrays to valuate equality.
|
|
6
|
+
* if one side is null or undefined, it returns true when other side is the same.
|
|
7
|
+
* this function has compatibility to `AlmostArray` like `Uint8Array` etc.
|
|
8
|
+
* @param v1 it uses equal operator for comparing elements, so applying object element is not recommended.
|
|
9
|
+
* @param v2 same as v1.
|
|
10
|
+
* @param sort it uses {@link Array.sort()} on v1 and v2 if true. default is true.
|
|
11
|
+
* @param useStrictEqual check equality whether `Array` or not and it uses `===` operator for compareing elements if true, otherwise using `==` operator. default is true.
|
|
12
|
+
*/
|
|
4
13
|
function eq(v1, v2, op = {}) {
|
|
5
14
|
const { sort, useStrictEqual } = Object.assign({ sort: true, useStrictEqual: true }, op);
|
|
6
15
|
if (v1 && !v2 || !v1 && v2)
|
|
@@ -9,7 +18,9 @@ export var UArray;
|
|
|
9
18
|
return true;
|
|
10
19
|
if (v1.length !== v2.length)
|
|
11
20
|
return false;
|
|
12
|
-
|
|
21
|
+
if (useStrictEqual && v1 instanceof Array !== v2 instanceof Array)
|
|
22
|
+
return false;
|
|
23
|
+
const a = sort ? v1.slice().sort() : v1, b = sort ? v2.slice().sort() : v2;
|
|
13
24
|
return a.every((v, i) => useStrictEqual ? v === b[i] : v == b[i]);
|
|
14
25
|
}
|
|
15
26
|
UArray.eq = eq;
|
package/build/func/u-obj.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NormalRecord } from "../const/types";
|
|
1
|
+
import { MaybeArray, NonObject, NormalRecord, Type } from "../const/types";
|
|
2
2
|
export declare namespace UObj {
|
|
3
3
|
/**
|
|
4
4
|
* assign properties to the object with specified property keys.
|
|
@@ -10,9 +10,23 @@ export declare namespace UObj {
|
|
|
10
10
|
function assignProperties<T extends NormalRecord, S extends NormalRecord>(t: T, s: S, keys?: (keyof S)[], keepDtypeClass?: boolean): T & Partial<S>;
|
|
11
11
|
/**
|
|
12
12
|
* crop properties of the object. the properties is removed with `delete` operator.
|
|
13
|
-
* @param o object
|
|
13
|
+
* @param o object whose properties is removed.
|
|
14
14
|
* @param keys property names to be remained. if omit this, it removes the properties other than properties decorated {@link DType}.
|
|
15
15
|
* @param exclusive if true, it removes `keys` instead of remaining it.
|
|
16
16
|
*/
|
|
17
17
|
function crop<T extends NormalRecord>(o: T, keys?: (keyof T)[], exclusive?: boolean): Partial<T>;
|
|
18
|
+
/**
|
|
19
|
+
* manipulate properties of an object.
|
|
20
|
+
* as default if the properties contains object, it also manipulates properties of that recursively.
|
|
21
|
+
* @param o object whose properties the process applies to.
|
|
22
|
+
* @param process process to be applied to properties of the object. note that function property is not included in the properties.
|
|
23
|
+
* @param op.ignoreEmpty skip null or undefined properties to manipuldate. default is true.
|
|
24
|
+
* @param op.recursive whether it manipulate properties of an object recursively. default is true.
|
|
25
|
+
* @param op.targetType primitive types which filter the properties to be processed.
|
|
26
|
+
*/
|
|
27
|
+
function manipulateProperties<T extends NormalRecord>(o: T, process: (v: NonObject) => NonObject, op?: {
|
|
28
|
+
ignoreEmpty?: boolean;
|
|
29
|
+
recursive?: boolean;
|
|
30
|
+
targetType?: MaybeArray<Exclude<Type, "object" | "null" | "undefined">>;
|
|
31
|
+
}): T;
|
|
18
32
|
}
|
package/build/func/u-obj.js
CHANGED
|
@@ -22,7 +22,7 @@ export var UObj;
|
|
|
22
22
|
UObj.assignProperties = assignProperties;
|
|
23
23
|
/**
|
|
24
24
|
* crop properties of the object. the properties is removed with `delete` operator.
|
|
25
|
-
* @param o object
|
|
25
|
+
* @param o object whose properties is removed.
|
|
26
26
|
* @param keys property names to be remained. if omit this, it removes the properties other than properties decorated {@link DType}.
|
|
27
27
|
* @param exclusive if true, it removes `keys` instead of remaining it.
|
|
28
28
|
*/
|
|
@@ -38,4 +38,32 @@ export var UObj;
|
|
|
38
38
|
return o;
|
|
39
39
|
}
|
|
40
40
|
UObj.crop = crop;
|
|
41
|
+
/**
|
|
42
|
+
* manipulate properties of an object.
|
|
43
|
+
* as default if the properties contains object, it also manipulates properties of that recursively.
|
|
44
|
+
* @param o object whose properties the process applies to.
|
|
45
|
+
* @param process process to be applied to properties of the object. note that function property is not included in the properties.
|
|
46
|
+
* @param op.ignoreEmpty skip null or undefined properties to manipuldate. default is true.
|
|
47
|
+
* @param op.recursive whether it manipulate properties of an object recursively. default is true.
|
|
48
|
+
* @param op.targetType primitive types which filter the properties to be processed.
|
|
49
|
+
*/
|
|
50
|
+
function manipulateProperties(o, process, op) {
|
|
51
|
+
const target = op?.targetType && UType.takeAsArray(op?.targetType);
|
|
52
|
+
const _ignoreEmpty = !UType.isDefined(op?.ignoreEmpty) || op?.ignoreEmpty;
|
|
53
|
+
const _recursive = !UType.isDefined(op?.recursive) || op?.recursive;
|
|
54
|
+
const rec = (_o) => {
|
|
55
|
+
for (const k in _o) {
|
|
56
|
+
const prop = _o[k];
|
|
57
|
+
if (_ignoreEmpty && UType.isEmpty(prop))
|
|
58
|
+
continue;
|
|
59
|
+
if (UType.isObject(prop) && _recursive)
|
|
60
|
+
rec(prop);
|
|
61
|
+
else if (!UType.isFunction(prop) && (!target || target.some(t => typeof prop === t)))
|
|
62
|
+
_o[k] = process(prop);
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
rec(o);
|
|
66
|
+
return o;
|
|
67
|
+
}
|
|
68
|
+
UObj.manipulateProperties = manipulateProperties;
|
|
41
69
|
})(UObj || (UObj = {}));
|
package/build/func/u-type.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export declare namespace UType {
|
|
|
8
8
|
function isBoolean(v: any): v is boolean;
|
|
9
9
|
function isSymbol(v: any): v is symbol;
|
|
10
10
|
function isObject(v: any): v is object;
|
|
11
|
+
function isFunction(v: any): v is Function;
|
|
11
12
|
function isArray(v: any, t: Type.string): v is string[];
|
|
12
13
|
function isArray(v: any, t: Type.number): v is number[];
|
|
13
14
|
function isArray(v: any, t: Type.bigint): v is bigint[];
|
package/build/func/u-type.js
CHANGED
|
@@ -22,6 +22,8 @@ export var UType;
|
|
|
22
22
|
UType.isSymbol = isSymbol;
|
|
23
23
|
function isObject(v) { return typeof v === Type.object; }
|
|
24
24
|
UType.isObject = isObject;
|
|
25
|
+
function isFunction(v) { return typeof v === "function"; }
|
|
26
|
+
UType.isFunction = isFunction;
|
|
25
27
|
function isArray(v, t) {
|
|
26
28
|
return Array.isArray(v) && (!t || v.every(e => typeof e === t));
|
|
27
29
|
}
|
|
@@ -42,10 +44,15 @@ export var UType;
|
|
|
42
44
|
return td.req ? [k] : [];
|
|
43
45
|
if (td.t && typeof prop !== td.t)
|
|
44
46
|
return [k];
|
|
47
|
+
const joinKey = (k2) => `${k}.${k2}`;
|
|
45
48
|
if (td.ary)
|
|
46
|
-
return Array.isArray(prop)
|
|
49
|
+
return Array.isArray(prop)
|
|
50
|
+
? prop.flatMap((e, i) => validateProp(i.toString(), e, td.ary)).map(joinKey) : [k];
|
|
51
|
+
if (td.rcd)
|
|
52
|
+
return UType.isObject(prop)
|
|
53
|
+
? Object.entries(prop).flatMap(e => validateProp(e[0], e[1], td.rcd)).map(joinKey) : [k];
|
|
47
54
|
if (td.rec)
|
|
48
|
-
return validate(prop).flatMap(
|
|
55
|
+
return validate(prop).flatMap(joinKey);
|
|
49
56
|
return [];
|
|
50
57
|
}
|
|
51
58
|
function takeAsArray(v) {
|
package/build/func/u.d.ts
CHANGED
|
@@ -1,28 +1,43 @@
|
|
|
1
|
-
import { Loggable } from "../const/types";
|
|
1
|
+
import { Loggable, MaybePromise } from "../const/types";
|
|
2
2
|
export declare function getJSTDate(d?: Date): Date;
|
|
3
3
|
export declare function delay(sec: number): Promise<void>;
|
|
4
4
|
export declare function int2array(size: number): number[];
|
|
5
5
|
export declare function array2map<K, T>(array: T[], keyGen: (e: T) => K): Map<K, T[]>;
|
|
6
6
|
export declare function bitor(...bit: number[]): number;
|
|
7
|
-
export interface RetryOption<T =
|
|
7
|
+
export interface RetryOption<T = MaybePromise> {
|
|
8
|
+
/**
|
|
9
|
+
* number of retries. default is 1.
|
|
10
|
+
*/
|
|
8
11
|
count?: number;
|
|
12
|
+
/**
|
|
13
|
+
* logger used for exceptions while retrying the process. default is `console` object.
|
|
14
|
+
*/
|
|
9
15
|
logger?: Loggable;
|
|
16
|
+
/**
|
|
17
|
+
* distinguish whether retry is required form exceptions. default is none. (i.e. allways required.)
|
|
18
|
+
*/
|
|
10
19
|
errorCriterion?: (e: any) => boolean;
|
|
20
|
+
/**
|
|
21
|
+
* predicate that runs between callbacks when retrying.
|
|
22
|
+
*/
|
|
11
23
|
intervalPredicate?: () => T;
|
|
12
24
|
}
|
|
13
25
|
export interface SyncRetryOption extends RetryOption<void> {
|
|
14
26
|
}
|
|
15
27
|
export interface AsyncRetryOption extends RetryOption {
|
|
28
|
+
/**
|
|
29
|
+
* secounds to wait between callbacks. this wait occurs after `intervalPredicate`.
|
|
30
|
+
*/
|
|
16
31
|
intervalSec?: number;
|
|
17
32
|
}
|
|
18
33
|
/**
|
|
19
34
|
* runs callback with customizable retry.
|
|
20
35
|
* @param cb callback to be retried.
|
|
21
|
-
* @param op.count
|
|
22
|
-
* @param op.logger
|
|
23
|
-
* @param op.errorCriterion
|
|
24
|
-
* @param op.intervalSec
|
|
25
|
-
* @param op.intervalPredicate
|
|
36
|
+
* @param op.count {@link RetryOption.count}
|
|
37
|
+
* @param op.logger {@link RetryOption.logger}
|
|
38
|
+
* @param op.errorCriterion {@link RetryOption.errorCriterion}
|
|
39
|
+
* @param op.intervalSec {@link AsyncRetryOption.intervalSec}
|
|
40
|
+
* @param op.intervalPredicate {@link RetryOption.intervalPredicate}
|
|
26
41
|
*/
|
|
27
42
|
export declare function retry<T>(cb: () => T, op?: SyncRetryOption): T;
|
|
28
43
|
export declare function retry<T>(cb: () => T, op?: AsyncRetryOption): Promise<T>;
|
package/build/index.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
export * from "./const/types";
|
|
2
2
|
export * from "./const/time-unit";
|
|
3
|
-
export * from "./const/gender";
|
|
4
3
|
export * from "./const/http-method";
|
|
5
|
-
export * from "./const/ccy";
|
|
6
4
|
export * from "./func/u";
|
|
7
5
|
export * from "./func/u-obj";
|
|
8
6
|
export * from "./func/u-string";
|
package/build/index.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
export * from "./const/types";
|
|
2
2
|
export * from "./const/time-unit";
|
|
3
|
-
export * from "./const/gender";
|
|
4
3
|
export * from "./const/http-method";
|
|
5
|
-
export * from "./const/ccy";
|
|
6
4
|
export * from "./func/u";
|
|
7
5
|
export * from "./func/u-obj";
|
|
8
6
|
export * from "./func/u-string";
|
package/package.json
CHANGED
package/build/const/ccy.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export interface Ccy {
|
|
2
|
-
symbol: t_ccySymbol;
|
|
3
|
-
crossUsd: string;
|
|
4
|
-
}
|
|
5
|
-
export type t_ccySymbol = keyof (typeof currencies);
|
|
6
|
-
declare const currencies: {
|
|
7
|
-
jpy: Ccy;
|
|
8
|
-
usd: Ccy;
|
|
9
|
-
gbp: Ccy;
|
|
10
|
-
eur: Ccy;
|
|
11
|
-
cad: Ccy;
|
|
12
|
-
aud: Ccy;
|
|
13
|
-
};
|
|
14
|
-
export declare const s_ccy: {
|
|
15
|
-
[k in t_ccySymbol]: Readonly<Ccy>;
|
|
16
|
-
};
|
|
17
|
-
export declare function resolveCcy(str: string): Ccy;
|
|
18
|
-
export {};
|
package/build/const/ccy.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
const currencies = {
|
|
2
|
-
jpy: { crossUsd: "usd/jpy" },
|
|
3
|
-
usd: { crossUsd: null },
|
|
4
|
-
gbp: { crossUsd: "gbp/usd" },
|
|
5
|
-
eur: { crossUsd: "eur/usd" },
|
|
6
|
-
cad: { crossUsd: "cad/usd" },
|
|
7
|
-
aud: { crossUsd: "aud/usd" }
|
|
8
|
-
};
|
|
9
|
-
export const s_ccy = (() => {
|
|
10
|
-
Object.entries(currencies).forEach(kv => { kv[1].symbol = kv[0]; currencies[kv[0]] = Object.freeze(kv[1]); });
|
|
11
|
-
return Object.freeze(currencies);
|
|
12
|
-
})();
|
|
13
|
-
export function resolveCcy(str) {
|
|
14
|
-
const ccyKey = Object.keys(s_ccy).find(k => str?.toLowerCase() == k);
|
|
15
|
-
return ccyKey && s_ccy[ccyKey];
|
|
16
|
-
}
|
package/build/const/gender.d.ts
DELETED