@daysnap/utils 0.1.11 → 0.1.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/docs/classes/Storage.md +239 -0
  2. package/docs/interfaces/EventBusCallback.md +1 -1
  3. package/docs/interfaces/StorageManager.md +4 -4
  4. package/docs/interfaces/Trap.md +5 -5
  5. package/docs/modules.md +203 -141
  6. package/es/{chunk-3OUQEOSR.js → chunk-2SUOLGG5.js} +1 -1
  7. package/es/chunk-56QUZDMU.js +67 -0
  8. package/es/{chunk-NOT3VNHC.js → chunk-A3YS6665.js} +5 -1
  9. package/es/{chunk-UMUYJJ3M.js → chunk-DLAUZWWO.js} +1 -1
  10. package/es/chunk-HNKJXGCC.js +19 -0
  11. package/es/{chunk-HREC4YYI.js → chunk-JZKIIY3L.js} +2 -2
  12. package/es/{chunk-3IKNCOC3.js → chunk-ORI5P5UA.js} +2 -2
  13. package/es/{chunk-KG436SDV.js → chunk-PSACVUUL.js} +1 -1
  14. package/es/{chunk-EY27J7WJ.js → chunk-S6ZV2M6N.js} +1 -1
  15. package/es/{chunk-YGYLI2DC.js → chunk-TZ2EQSRZ.js} +1 -1
  16. package/es/{chunk-I65EJPPI.js → chunk-UMJU7UF2.js} +1 -1
  17. package/es/{chunk-PE43T234.js → chunk-WXD7J2FR.js} +2 -2
  18. package/es/filterEmptyValue.js +2 -2
  19. package/es/formartDateToZN.js +3 -3
  20. package/es/formatDate.js +2 -2
  21. package/es/getDateBoundsByMonths.d.ts +7 -0
  22. package/es/getDateBoundsByMonths.js +9 -0
  23. package/es/getMonthBounds.js +3 -3
  24. package/es/getRandom.js +2 -2
  25. package/es/getRandomNumber.js +3 -3
  26. package/es/getRangeDate.js +3 -3
  27. package/es/getWeekday.js +2 -2
  28. package/es/index.d.ts +2 -0
  29. package/es/index.js +45 -37
  30. package/es/isValidDate.js +2 -2
  31. package/es/listGenerator.d.ts +1 -0
  32. package/es/listGenerator.js +1 -1
  33. package/es/normalizeDate.js +1 -1
  34. package/es/storage/index.d.ts +1 -0
  35. package/es/storage/index.js +5 -1
  36. package/es/storage/storage.d.ts +40 -0
  37. package/es/storage/storage.js +8 -0
  38. package/lib/{chunk-XJIRG4UL.cjs → chunk-2C3XINC3.cjs} +1 -1
  39. package/lib/chunk-44UMWNOZ.cjs +19 -0
  40. package/lib/{chunk-P3BVNREA.cjs → chunk-6TABJ32L.cjs} +2 -2
  41. package/lib/{chunk-BPNPYUBR.cjs → chunk-BQ7SLF6C.cjs} +2 -2
  42. package/lib/chunk-GQFHHWIV.cjs +67 -0
  43. package/lib/{chunk-RTTG26O5.cjs → chunk-HEVW5ZN2.cjs} +5 -1
  44. package/lib/{chunk-EJV6YDGC.cjs → chunk-IGD442DS.cjs} +2 -2
  45. package/lib/{chunk-GLLD74FC.cjs → chunk-JFPD5JTY.cjs} +2 -2
  46. package/lib/{chunk-CANF5KF5.cjs → chunk-KT3FWGJG.cjs} +4 -4
  47. package/lib/{chunk-2DCEWABW.cjs → chunk-NEFFCHO5.cjs} +5 -5
  48. package/lib/{chunk-LJYE7HIT.cjs → chunk-SOBKBDEC.cjs} +2 -2
  49. package/lib/{chunk-ELDXB7BZ.cjs → chunk-SZOUFWPJ.cjs} +4 -4
  50. package/lib/filterEmptyValue.cjs +3 -3
  51. package/lib/formartDateToZN.cjs +4 -4
  52. package/lib/formatDate.cjs +3 -3
  53. package/lib/getDateBoundsByMonths.cjs +9 -0
  54. package/lib/getDateBoundsByMonths.d.cts +7 -0
  55. package/lib/getMonthBounds.cjs +4 -4
  56. package/lib/getRandom.cjs +3 -3
  57. package/lib/getRandomNumber.cjs +4 -4
  58. package/lib/getRangeDate.cjs +4 -4
  59. package/lib/getWeekday.cjs +3 -3
  60. package/lib/index.cjs +38 -30
  61. package/lib/index.d.cts +2 -0
  62. package/lib/isValidDate.cjs +3 -3
  63. package/lib/listGenerator.cjs +2 -2
  64. package/lib/listGenerator.d.cts +1 -0
  65. package/lib/normalizeDate.cjs +2 -2
  66. package/lib/storage/index.cjs +6 -2
  67. package/lib/storage/index.d.cts +1 -0
  68. package/lib/storage/storage.cjs +8 -0
  69. package/lib/storage/storage.d.cts +40 -0
  70. package/package.json +1 -1
  71. package/es/{chunk-IJCLLBSR.js → chunk-LG2TIXRB.js} +0 -0
  72. package/es/{chunk-4WQPAGCE.js → chunk-NXEL6RMI.js} +3 -3
  73. package/lib/{chunk-C522WKFY.cjs → chunk-2PEWYRYD.cjs} +0 -0
  74. package/lib/{chunk-6LOBB2KW.cjs → chunk-PYFTXKFI.cjs} +3 -3
@@ -1,6 +1,6 @@
1
1
  // src/listGenerator.ts
2
2
  function listGenerator(length, fn) {
3
- return new Array(length).fill("").map((_, index) => fn(index));
3
+ return new Array(length).fill("").map((_, index) => fn ? fn(index) : index);
4
4
  }
5
5
 
6
6
  export {
@@ -0,0 +1,67 @@
1
+ import {
2
+ isArray
3
+ } from "./chunk-CSZ7G34M.js";
4
+ import {
5
+ isObject
6
+ } from "./chunk-XCSSSEK2.js";
7
+
8
+ // src/storage/storage.ts
9
+ var Storage = class {
10
+ key;
11
+ storage;
12
+ value = null;
13
+ constructor(key, storage) {
14
+ this.key = key;
15
+ this.storage = storage;
16
+ }
17
+ /**
18
+ * 设置值
19
+ */
20
+ setItem(val) {
21
+ this.value = null;
22
+ this.storage.setItem(this.key, JSON.stringify(val));
23
+ return val;
24
+ }
25
+ getItem(defaultVal) {
26
+ const val = this.storage.getItem(this.key);
27
+ if (val === null) {
28
+ return defaultVal ?? null;
29
+ }
30
+ return JSON.parse(val);
31
+ }
32
+ /**
33
+ * 删除值
34
+ */
35
+ removeItem() {
36
+ this.value = null;
37
+ this.storage.removeItem(this.key);
38
+ }
39
+ /**
40
+ * 更新值
41
+ */
42
+ updateItem(val) {
43
+ this.value = null;
44
+ const oldVal = this.getItem();
45
+ if (isArray(val) && isArray(oldVal)) {
46
+ val = [...oldVal, ...val];
47
+ } else if (isObject(val) && isObject(oldVal)) {
48
+ val = { ...oldVal, ...val };
49
+ }
50
+ return this.setItem(val);
51
+ }
52
+ getItemOnce(defaultVal) {
53
+ const val = this.storage.getItem(this.key);
54
+ if (val === null) {
55
+ return defaultVal ?? null;
56
+ }
57
+ this.removeItem();
58
+ return JSON.parse(val);
59
+ }
60
+ getItemWithCache(defaultVal) {
61
+ return this.value ?? (this.value = this.getItem(defaultVal));
62
+ }
63
+ };
64
+
65
+ export {
66
+ Storage
67
+ };
@@ -4,8 +4,12 @@ import {
4
4
 
5
5
  // src/normalizeDate.ts
6
6
  function normalizeDate(value) {
7
- if (isString(value)) {
7
+ if (isString(value) && !value.endsWith("Z")) {
8
8
  value = value.replace(/-/g, "/");
9
+ const arr = value.split("/");
10
+ if (arr.length < 3) {
11
+ value = `${value}/01`;
12
+ }
9
13
  }
10
14
  return new Date(value);
11
15
  }
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  listGenerator
3
- } from "./chunk-3OUQEOSR.js";
3
+ } from "./chunk-2SUOLGG5.js";
4
4
 
5
5
  // src/getRandom.ts
6
6
  function getRandom(length, alphabet = "1234567890qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM") {
@@ -0,0 +1,19 @@
1
+ import {
2
+ formatDate
3
+ } from "./chunk-UMJU7UF2.js";
4
+ import {
5
+ normalizeDate
6
+ } from "./chunk-A3YS6665.js";
7
+
8
+ // src/getDateBoundsByMonths.ts
9
+ function getDateBoundsByMonths(monthsCount = 1, date = /* @__PURE__ */ new Date(), fmt) {
10
+ const endDate = normalizeDate(date);
11
+ const end = new Date(endDate.getFullYear(), endDate.getMonth() + 1, 0);
12
+ const startMonth = end.getMonth() - (monthsCount - 1);
13
+ const start = new Date(end.getFullYear(), startMonth, 1);
14
+ return fmt ? [formatDate(start, fmt), formatDate(end, fmt)] : [start, end];
15
+ }
16
+
17
+ export {
18
+ getDateBoundsByMonths
19
+ };
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  formatDate
3
- } from "./chunk-I65EJPPI.js";
3
+ } from "./chunk-UMJU7UF2.js";
4
4
  import {
5
5
  normalizeDate
6
- } from "./chunk-NOT3VNHC.js";
6
+ } from "./chunk-A3YS6665.js";
7
7
 
8
8
  // src/getRangeDate.ts
9
9
  function getRangeDate(sv, ev, fmt) {
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  formatDate
3
- } from "./chunk-I65EJPPI.js";
3
+ } from "./chunk-UMJU7UF2.js";
4
4
  import {
5
5
  normalizeDate
6
- } from "./chunk-NOT3VNHC.js";
6
+ } from "./chunk-A3YS6665.js";
7
7
 
8
8
  // src/getMonthBounds.ts
9
9
  function getMonthBounds(value, fmt) {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  normalizeDate
3
- } from "./chunk-NOT3VNHC.js";
3
+ } from "./chunk-A3YS6665.js";
4
4
 
5
5
  // src/getWeekday.ts
6
6
  function getWeekday(value = /* @__PURE__ */ new Date(), prefix = "\u5468") {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  normalizeDate
3
- } from "./chunk-NOT3VNHC.js";
3
+ } from "./chunk-A3YS6665.js";
4
4
 
5
5
  // src/isValidDate.ts
6
6
  function isValidDate(v) {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getRandom
3
- } from "./chunk-UMUYJJ3M.js";
3
+ } from "./chunk-DLAUZWWO.js";
4
4
 
5
5
  // src/getRandomNumber.ts
6
6
  function getRandomNumber(length) {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  normalizeDate
3
- } from "./chunk-NOT3VNHC.js";
3
+ } from "./chunk-A3YS6665.js";
4
4
 
5
5
  // src/formatDate.ts
6
6
  function formatDate(val = /* @__PURE__ */ new Date(), fmt = "yyyy-MM-dd hh:mm:ss") {
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  formatDate
3
- } from "./chunk-I65EJPPI.js";
3
+ } from "./chunk-UMJU7UF2.js";
4
4
  import {
5
5
  normalizeDate
6
- } from "./chunk-NOT3VNHC.js";
6
+ } from "./chunk-A3YS6665.js";
7
7
 
8
8
  // src/formartDateToZN.ts
9
9
  function formatDateToZN(v) {
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  filterEmptyValue
3
- } from "./chunk-4WQPAGCE.js";
3
+ } from "./chunk-NXEL6RMI.js";
4
+ import "./chunk-GVYBTJDA.js";
4
5
  import "./chunk-WCZPEH7E.js";
5
6
  import "./chunk-YGV2UKBN.js";
6
7
  import "./chunk-ELR2DZ56.js";
7
- import "./chunk-GVYBTJDA.js";
8
8
  import "./chunk-3KRJNCKB.js";
9
9
  import "./chunk-KOOGLWJ5.js";
10
10
  import "./chunk-CSZ7G34M.js";
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  formatDateToZN
3
- } from "./chunk-PE43T234.js";
4
- import "./chunk-I65EJPPI.js";
5
- import "./chunk-NOT3VNHC.js";
3
+ } from "./chunk-WXD7J2FR.js";
4
+ import "./chunk-UMJU7UF2.js";
5
+ import "./chunk-A3YS6665.js";
6
6
  import "./chunk-F4QMON2N.js";
7
7
  export {
8
8
  formatDateToZN
package/es/formatDate.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  formatDate
3
- } from "./chunk-I65EJPPI.js";
4
- import "./chunk-NOT3VNHC.js";
3
+ } from "./chunk-UMJU7UF2.js";
4
+ import "./chunk-A3YS6665.js";
5
5
  import "./chunk-F4QMON2N.js";
6
6
  export {
7
7
  formatDate
@@ -0,0 +1,7 @@
1
+ /**
2
+ * 说明
3
+ */
4
+ declare function getDateBoundsByMonths(monthsCount: number, date: string | number | Date): [Date, Date];
5
+ declare function getDateBoundsByMonths(monthsCount: number, date: string | number | Date, fmt: string): [string, string];
6
+
7
+ export { getDateBoundsByMonths };
@@ -0,0 +1,9 @@
1
+ import {
2
+ getDateBoundsByMonths
3
+ } from "./chunk-HNKJXGCC.js";
4
+ import "./chunk-UMJU7UF2.js";
5
+ import "./chunk-A3YS6665.js";
6
+ import "./chunk-F4QMON2N.js";
7
+ export {
8
+ getDateBoundsByMonths
9
+ };
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  getMonthBounds
3
- } from "./chunk-3IKNCOC3.js";
4
- import "./chunk-I65EJPPI.js";
5
- import "./chunk-NOT3VNHC.js";
3
+ } from "./chunk-ORI5P5UA.js";
4
+ import "./chunk-UMJU7UF2.js";
5
+ import "./chunk-A3YS6665.js";
6
6
  import "./chunk-F4QMON2N.js";
7
7
  export {
8
8
  getMonthBounds
package/es/getRandom.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  getRandom
3
- } from "./chunk-UMUYJJ3M.js";
4
- import "./chunk-3OUQEOSR.js";
3
+ } from "./chunk-DLAUZWWO.js";
4
+ import "./chunk-2SUOLGG5.js";
5
5
  export {
6
6
  getRandom
7
7
  };
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  getRandomNumber
3
- } from "./chunk-YGYLI2DC.js";
4
- import "./chunk-UMUYJJ3M.js";
5
- import "./chunk-3OUQEOSR.js";
3
+ } from "./chunk-TZ2EQSRZ.js";
4
+ import "./chunk-DLAUZWWO.js";
5
+ import "./chunk-2SUOLGG5.js";
6
6
  export {
7
7
  getRandomNumber
8
8
  };
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  getRangeDate
3
- } from "./chunk-HREC4YYI.js";
4
- import "./chunk-I65EJPPI.js";
5
- import "./chunk-NOT3VNHC.js";
3
+ } from "./chunk-JZKIIY3L.js";
4
+ import "./chunk-UMJU7UF2.js";
5
+ import "./chunk-A3YS6665.js";
6
6
  import "./chunk-F4QMON2N.js";
7
7
  export {
8
8
  getRangeDate
package/es/getWeekday.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  getWeekday
3
- } from "./chunk-KG436SDV.js";
4
- import "./chunk-NOT3VNHC.js";
3
+ } from "./chunk-PSACVUUL.js";
4
+ import "./chunk-A3YS6665.js";
5
5
  import "./chunk-F4QMON2N.js";
6
6
  export {
7
7
  getWeekday
package/es/index.d.ts CHANGED
@@ -37,6 +37,7 @@ export { formatFileSize } from './formatFileSize.js';
37
37
  export { formatMessage } from './formatMessage.js';
38
38
  export { formatPathParams } from './formatPathParams.js';
39
39
  export { getBlobByUrl } from './getBlobByUrl.js';
40
+ export { getDateBoundsByMonths } from './getDateBoundsByMonths.js';
40
41
  export { getDayMillisecond } from './getDayMillisecond.js';
41
42
  export { getImageInfo } from './getImageInfo.js';
42
43
  export { getMonthBounds } from './getMonthBounds.js';
@@ -123,4 +124,5 @@ export { typeOf } from './typeOf.js';
123
124
  export { withCache } from './withCache.js';
124
125
  export { withPreventConsecutiveClicks } from './withPreventConsecutiveClicks.js';
125
126
  export { StorageManager, factory } from './storage/factory.js';
127
+ export { Storage } from './storage/storage.js';
126
128
  import '@daysnap/types';
package/es/index.js CHANGED
@@ -1,3 +1,6 @@
1
+ import {
2
+ toDBC
3
+ } from "./chunk-ONTP5SDE.js";
1
4
  import {
2
5
  createTrapInstance,
3
6
  trap
@@ -14,10 +17,16 @@ import {
14
17
  import {
15
18
  getCache,
16
19
  getLocal
17
- } from "./chunk-IJCLLBSR.js";
20
+ } from "./chunk-LG2TIXRB.js";
18
21
  import {
19
22
  factory
20
23
  } from "./chunk-M6B3UGFI.js";
24
+ import {
25
+ Storage
26
+ } from "./chunk-56QUZDMU.js";
27
+ import {
28
+ setScrollTop
29
+ } from "./chunk-BULTIEJG.js";
21
30
  import {
22
31
  sleep
23
32
  } from "./chunk-TNIIDDN4.js";
@@ -42,8 +51,8 @@ import {
42
51
  toCDB
43
52
  } from "./chunk-J2Y5ZZA3.js";
44
53
  import {
45
- toDBC
46
- } from "./chunk-ONTP5SDE.js";
54
+ pascalCase
55
+ } from "./chunk-S7PUCGCQ.js";
47
56
  import {
48
57
  pick
49
58
  } from "./chunk-IPAT3N4P.js";
@@ -66,8 +75,8 @@ import {
66
75
  scrollToTop
67
76
  } from "./chunk-P7QW362C.js";
68
77
  import {
69
- setScrollTop
70
- } from "./chunk-BULTIEJG.js";
78
+ omit
79
+ } from "./chunk-6GTFQZL4.js";
71
80
  import {
72
81
  padding
73
82
  } from "./chunk-CCZL3GEW.js";
@@ -87,8 +96,8 @@ import {
87
96
  parseQueryString
88
97
  } from "./chunk-SZ7IZE42.js";
89
98
  import {
90
- pascalCase
91
- } from "./chunk-S7PUCGCQ.js";
99
+ isWindow
100
+ } from "./chunk-QYCMY2T4.js";
92
101
  import {
93
102
  kebabCase
94
103
  } from "./chunk-IPIA4Z65.js";
@@ -105,8 +114,8 @@ import {
105
114
  normalizePath
106
115
  } from "./chunk-CMP4T3ZH.js";
107
116
  import {
108
- omit
109
- } from "./chunk-6GTFQZL4.js";
117
+ isRegExp
118
+ } from "./chunk-Y4V5R7XA.js";
110
119
  import {
111
120
  isType
112
121
  } from "./chunk-5EVWQVDV.js";
@@ -115,7 +124,7 @@ import {
115
124
  } from "./chunk-D5O4LXN3.js";
116
125
  import {
117
126
  isValidDate
118
- } from "./chunk-EY27J7WJ.js";
127
+ } from "./chunk-S6ZV2M6N.js";
119
128
  import {
120
129
  isWeChat,
121
130
  isWeixin
@@ -124,8 +133,8 @@ import {
124
133
  isWeChatMiniProgram
125
134
  } from "./chunk-SQ3L6IQW.js";
126
135
  import {
127
- isWindow
128
- } from "./chunk-QYCMY2T4.js";
136
+ isLicenseCode
137
+ } from "./chunk-576ZRCUO.js";
129
138
  import {
130
139
  isMobile
131
140
  } from "./chunk-L52JSZDZ.js";
@@ -141,9 +150,6 @@ import {
141
150
  import {
142
151
  isPromise
143
152
  } from "./chunk-LJ4CEJ5C.js";
144
- import {
145
- isRegExp
146
- } from "./chunk-Y4V5R7XA.js";
147
153
  import {
148
154
  isError
149
155
  } from "./chunk-6UGTRW2S.js";
@@ -163,8 +169,8 @@ import {
163
169
  isLan
164
170
  } from "./chunk-VTSGSUL2.js";
165
171
  import {
166
- isLicenseCode
167
- } from "./chunk-576ZRCUO.js";
172
+ isAndroid
173
+ } from "./chunk-SWLGSN5X.js";
168
174
  import {
169
175
  isBoolean
170
176
  } from "./chunk-ZWXX326Y.js";
@@ -177,9 +183,12 @@ import {
177
183
  import {
178
184
  isEmail
179
185
  } from "./chunk-JMUWQLHE.js";
186
+ import {
187
+ getVideoInfo
188
+ } from "./chunk-3ZZPPKM3.js";
180
189
  import {
181
190
  getWeekday
182
- } from "./chunk-KG436SDV.js";
191
+ } from "./chunk-PSACVUUL.js";
183
192
  import {
184
193
  inBrowser
185
194
  } from "./chunk-ZDRIUWKX.js";
@@ -196,35 +205,32 @@ import {
196
205
  isAmount
197
206
  } from "./chunk-YKTD7CLE.js";
198
207
  import {
199
- isAndroid
200
- } from "./chunk-SWLGSN5X.js";
208
+ getDayMillisecond
209
+ } from "./chunk-ZGN3KUXE.js";
201
210
  import {
202
211
  getImageInfo
203
212
  } from "./chunk-ANF3VZYM.js";
204
213
  import {
205
214
  getMonthBounds
206
- } from "./chunk-3IKNCOC3.js";
215
+ } from "./chunk-ORI5P5UA.js";
207
216
  import {
208
217
  getRandomColor
209
218
  } from "./chunk-D7OBO7J6.js";
210
219
  import {
211
220
  getRandomNumber
212
- } from "./chunk-YGYLI2DC.js";
221
+ } from "./chunk-TZ2EQSRZ.js";
213
222
  import {
214
223
  getRandom
215
- } from "./chunk-UMUYJJ3M.js";
224
+ } from "./chunk-DLAUZWWO.js";
216
225
  import {
217
226
  listGenerator
218
- } from "./chunk-3OUQEOSR.js";
227
+ } from "./chunk-2SUOLGG5.js";
219
228
  import {
220
229
  getRangeDate
221
- } from "./chunk-HREC4YYI.js";
230
+ } from "./chunk-JZKIIY3L.js";
222
231
  import {
223
232
  getScrollTop
224
233
  } from "./chunk-EFDRCKKS.js";
225
- import {
226
- getVideoInfo
227
- } from "./chunk-3ZZPPKM3.js";
228
234
  import {
229
235
  formatAmount
230
236
  } from "./chunk-KDND6GRD.js";
@@ -247,8 +253,8 @@ import {
247
253
  getBlobByUrl
248
254
  } from "./chunk-4QMOXXPL.js";
249
255
  import {
250
- getDayMillisecond
251
- } from "./chunk-ZGN3KUXE.js";
256
+ getDateBoundsByMonths
257
+ } from "./chunk-HNKJXGCC.js";
252
258
  import {
253
259
  filterCRLF
254
260
  } from "./chunk-S2FOFDX4.js";
@@ -257,7 +263,10 @@ import {
257
263
  } from "./chunk-CNCI66H4.js";
258
264
  import {
259
265
  filterEmptyValue
260
- } from "./chunk-4WQPAGCE.js";
266
+ } from "./chunk-NXEL6RMI.js";
267
+ import {
268
+ isEmptyObject
269
+ } from "./chunk-GVYBTJDA.js";
261
270
  import {
262
271
  isFunction
263
272
  } from "./chunk-WCZPEH7E.js";
@@ -267,9 +276,6 @@ import {
267
276
  import {
268
277
  isEmptyArray
269
278
  } from "./chunk-ELR2DZ56.js";
270
- import {
271
- isEmptyObject
272
- } from "./chunk-GVYBTJDA.js";
273
279
  import {
274
280
  isUndefined
275
281
  } from "./chunk-3KRJNCKB.js";
@@ -290,13 +296,13 @@ import {
290
296
  } from "./chunk-KJX7IWF5.js";
291
297
  import {
292
298
  formatDateToZN
293
- } from "./chunk-PE43T234.js";
299
+ } from "./chunk-WXD7J2FR.js";
294
300
  import {
295
301
  formatDate
296
- } from "./chunk-I65EJPPI.js";
302
+ } from "./chunk-UMJU7UF2.js";
297
303
  import {
298
304
  normalizeDate
299
- } from "./chunk-NOT3VNHC.js";
305
+ } from "./chunk-A3YS6665.js";
300
306
  import {
301
307
  isString
302
308
  } from "./chunk-F4QMON2N.js";
@@ -380,6 +386,7 @@ import {
380
386
  chooseMedia
381
387
  } from "./chunk-PFTWITSM.js";
382
388
  export {
389
+ Storage,
383
390
  ato,
384
391
  atob,
385
392
  base64ToBlob,
@@ -423,6 +430,7 @@ export {
423
430
  formatPathParams,
424
431
  getBlobByUrl,
425
432
  getCache,
433
+ getDateBoundsByMonths,
426
434
  getDayMillisecond,
427
435
  getImageInfo,
428
436
  getLocal,
package/es/isValidDate.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  isValidDate
3
- } from "./chunk-EY27J7WJ.js";
4
- import "./chunk-NOT3VNHC.js";
3
+ } from "./chunk-S6ZV2M6N.js";
4
+ import "./chunk-A3YS6665.js";
5
5
  import "./chunk-F4QMON2N.js";
6
6
  export {
7
7
  isValidDate
@@ -2,6 +2,7 @@
2
2
  * list 生成器,快速生成数据
3
3
  * @param length 个数
4
4
  */
5
+ declare function listGenerator(length: number): number[];
5
6
  declare function listGenerator<T = any>(length: number, fn: (index: number) => T): T[];
6
7
 
7
8
  export { listGenerator };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  listGenerator
3
- } from "./chunk-3OUQEOSR.js";
3
+ } from "./chunk-2SUOLGG5.js";
4
4
  export {
5
5
  listGenerator
6
6
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  normalizeDate
3
- } from "./chunk-NOT3VNHC.js";
3
+ } from "./chunk-A3YS6665.js";
4
4
  import "./chunk-F4QMON2N.js";
5
5
  export {
6
6
  normalizeDate
@@ -1,4 +1,5 @@
1
1
  export { StorageManager, factory } from './factory.js';
2
+ export { Storage } from './storage.js';
2
3
 
3
4
  declare const getCache: () => {
4
5
  setItem: <T = any>(key: string, val: T) => T;
@@ -1,13 +1,17 @@
1
1
  import {
2
2
  getCache,
3
3
  getLocal
4
- } from "../chunk-IJCLLBSR.js";
4
+ } from "../chunk-LG2TIXRB.js";
5
5
  import {
6
6
  factory
7
7
  } from "../chunk-M6B3UGFI.js";
8
+ import {
9
+ Storage
10
+ } from "../chunk-56QUZDMU.js";
8
11
  import "../chunk-CSZ7G34M.js";
9
12
  import "../chunk-XCSSSEK2.js";
10
13
  export {
14
+ Storage,
11
15
  factory,
12
16
  getCache,
13
17
  getLocal
@@ -0,0 +1,40 @@
1
+ interface StorageLike {
2
+ getItem: (key: string) => string | null;
3
+ setItem: (key: string, value: string) => void;
4
+ removeItem: (key: string) => void;
5
+ }
6
+ declare class Storage<T = any> {
7
+ private readonly key;
8
+ private readonly storage;
9
+ private value;
10
+ constructor(key: string, storage: StorageLike);
11
+ /**
12
+ * 设置值
13
+ */
14
+ setItem(val: T): T;
15
+ /**
16
+ * 获取值
17
+ */
18
+ getItem(): T | null;
19
+ getItem(defaultVal: Partial<T>): T;
20
+ /**
21
+ * 删除值
22
+ */
23
+ removeItem(): void;
24
+ /**
25
+ * 更新值
26
+ */
27
+ updateItem(val: Partial<T>): T;
28
+ /**
29
+ * 获取值后,删除存储的值
30
+ */
31
+ getItemOnce(): T | null;
32
+ getItemOnce(defaultVal: Partial<T>): T;
33
+ /**
34
+ * 优先从缓存中获取值
35
+ */
36
+ getItemWithCache(): T | null;
37
+ getItemWithCache(defaultVal: Partial<T>): T;
38
+ }
39
+
40
+ export { Storage };
@@ -0,0 +1,8 @@
1
+ import {
2
+ Storage
3
+ } from "../chunk-56QUZDMU.js";
4
+ import "../chunk-CSZ7G34M.js";
5
+ import "../chunk-XCSSSEK2.js";
6
+ export {
7
+ Storage
8
+ };