@gx-design-vue/pro-utils 0.2.0-beta.86 → 0.2.0-beta.88

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 (175) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +73 -2
  3. package/dist/array/index.d.ts +5 -0
  4. package/dist/array/index.js +6 -0
  5. package/dist/array/slice.d.ts +4 -0
  6. package/dist/array/slice.js +28 -0
  7. package/dist/array/sort.d.ts +7 -0
  8. package/dist/array/sort.js +65 -0
  9. package/dist/array/tree.d.ts +25 -0
  10. package/dist/array/tree.js +157 -0
  11. package/dist/array/unique.d.ts +6 -0
  12. package/dist/array/unique.js +14 -0
  13. package/dist/base64/index.d.ts +10 -19
  14. package/dist/base64/index.js +106 -0
  15. package/dist/class/index.d.ts +2 -0
  16. package/dist/class/index.js +3 -0
  17. package/dist/class/prefix.d.ts +15 -0
  18. package/dist/class/prefix.js +15 -0
  19. package/dist/clone/cloneDeep.d.ts +4 -0
  20. package/dist/clone/cloneDeep.js +35 -0
  21. package/dist/clone/cloneDeepWith.d.ts +6 -0
  22. package/dist/clone/cloneDeepWith.js +150 -0
  23. package/dist/clone/getTag.d.ts +4 -0
  24. package/dist/clone/getTag.js +13 -0
  25. package/dist/clone/index.d.ts +3 -0
  26. package/dist/clone/index.js +4 -0
  27. package/dist/clone/symbols.d.ts +4 -0
  28. package/dist/clone/symbols.js +13 -0
  29. package/dist/clone/tags.d.ts +25 -0
  30. package/dist/clone/tags.js +48 -0
  31. package/dist/dom/event.d.ts +5 -0
  32. package/dist/dom/event.js +26 -0
  33. package/dist/dom/index.d.ts +5 -0
  34. package/dist/dom/index.js +6 -0
  35. package/dist/dom/measure.d.ts +12 -0
  36. package/dist/dom/measure.js +42 -0
  37. package/dist/dom/raf.d.ts +7 -0
  38. package/dist/dom/raf.js +44 -0
  39. package/dist/dom/scroll.d.ts +10 -0
  40. package/dist/dom/scroll.js +74 -0
  41. package/dist/file/config.d.ts +10 -0
  42. package/dist/file/config.js +81 -0
  43. package/dist/file/convert.d.ts +8 -0
  44. package/dist/file/convert.js +69 -0
  45. package/dist/file/index.d.ts +5 -0
  46. package/dist/file/index.js +6 -0
  47. package/dist/file/media.d.ts +16 -0
  48. package/dist/file/media.js +161 -0
  49. package/dist/file/type.d.ts +6 -0
  50. package/dist/file/type.js +58 -0
  51. package/dist/function/copy.d.ts +6 -0
  52. package/dist/function/copy.js +13 -0
  53. package/dist/function/getValue.d.ts +5 -0
  54. package/dist/function/getValue.js +19 -0
  55. package/dist/function/index.d.ts +5 -0
  56. package/dist/function/index.js +6 -0
  57. package/dist/function/object.d.ts +6 -0
  58. package/dist/function/object.js +33 -0
  59. package/dist/function/run.d.ts +4 -0
  60. package/dist/function/run.js +15 -0
  61. package/dist/index.d.ts +58 -26
  62. package/dist/index.js +60 -0
  63. package/dist/is/base64.d.ts +5 -0
  64. package/dist/is/base64.js +27 -0
  65. package/dist/is/browser.d.ts +4 -0
  66. package/dist/is/browser.js +14 -0
  67. package/dist/is/deepEqual.d.ts +4 -0
  68. package/dist/is/deepEqual.js +62 -0
  69. package/dist/is/device.d.ts +6 -0
  70. package/dist/is/device.js +37 -0
  71. package/dist/is/equal.d.ts +4 -0
  72. package/dist/is/equal.js +34 -0
  73. package/dist/is/img.d.ts +4 -0
  74. package/dist/is/img.js +13 -0
  75. package/dist/is/index.d.ts +16 -0
  76. package/dist/is/index.js +17 -0
  77. package/dist/is/nil.d.ts +5 -0
  78. package/dist/is/nil.js +22 -0
  79. package/dist/is/plainObject.d.ts +5 -0
  80. package/dist/is/plainObject.js +30 -0
  81. package/dist/is/primitive.d.ts +4 -0
  82. package/dist/is/primitive.js +13 -0
  83. package/dist/is/server.d.ts +4 -0
  84. package/dist/is/server.js +10 -0
  85. package/dist/is/type.d.ts +11 -0
  86. package/dist/is/type.js +84 -0
  87. package/dist/is/typedArray.d.ts +4 -0
  88. package/dist/is/typedArray.js +33 -0
  89. package/dist/is/unsafeProperty.d.ts +4 -0
  90. package/dist/is/unsafeProperty.js +18 -0
  91. package/dist/is/url.d.ts +4 -0
  92. package/dist/is/url.js +20 -0
  93. package/dist/is/valid.d.ts +5 -0
  94. package/dist/is/valid.js +23 -0
  95. package/dist/merge/index.d.ts +6 -49
  96. package/dist/merge/index.js +41 -0
  97. package/dist/merge/mergeWith.d.ts +4 -49
  98. package/dist/merge/mergeWith.js +31 -0
  99. package/dist/number/chinese.d.ts +4 -0
  100. package/dist/number/chinese.js +46 -0
  101. package/dist/number/format.d.ts +13 -0
  102. package/dist/number/format.js +72 -0
  103. package/dist/number/index.d.ts +3 -0
  104. package/dist/number/index.js +4 -0
  105. package/dist/object/classNames.d.ts +4 -0
  106. package/dist/object/classNames.js +30 -0
  107. package/dist/object/index.d.ts +5 -0
  108. package/dist/object/index.js +6 -0
  109. package/dist/object/omitBoolean.d.ts +4 -0
  110. package/dist/object/omitBoolean.js +13 -0
  111. package/dist/object/omitUndefined.d.ts +6 -0
  112. package/dist/object/omitUndefined.js +18 -0
  113. package/dist/object/omitUndefinedAndEmptyArr.d.ts +4 -0
  114. package/dist/object/omitUndefinedAndEmptyArr.js +19 -0
  115. package/dist/pro-utils.js +1 -1166
  116. package/dist/string/duration.d.ts +4 -0
  117. package/dist/string/duration.js +25 -0
  118. package/dist/string/empty.d.ts +7 -0
  119. package/dist/string/empty.js +26 -0
  120. package/dist/string/index.d.ts +5 -0
  121. package/dist/string/index.js +6 -0
  122. package/dist/string/nanoid.d.ts +4 -0
  123. package/dist/string/nanoid.js +32 -0
  124. package/dist/string/uuid.d.ts +9 -0
  125. package/dist/string/uuid.js +57 -0
  126. package/dist/table/column.d.ts +13 -0
  127. package/dist/table/column.js +42 -0
  128. package/dist/table/index.d.ts +3 -0
  129. package/dist/table/index.js +4 -0
  130. package/dist/table/page.d.ts +6 -0
  131. package/dist/table/page.js +23 -0
  132. package/dist/typing.d.ts +37 -0
  133. package/dist/typing.js +1 -0
  134. package/dist/vue/index.d.ts +2 -0
  135. package/dist/vue/index.js +3 -0
  136. package/dist/vue/slots.d.ts +56 -0
  137. package/dist/vue/slots.js +89 -0
  138. package/package.json +48 -23
  139. package/dist/classNames/index.d.ts +0 -2
  140. package/dist/cloneDeep/cloneDeepWith.d.ts +0 -43
  141. package/dist/cloneDeep/index.d.ts +0 -47
  142. package/dist/getValueFromObjectByKey/index.d.ts +0 -3
  143. package/dist/isBrowser/index.d.ts +0 -1
  144. package/dist/isDeepEqualReact/index.d.ts +0 -1
  145. package/dist/isImg/index.d.ts +0 -2
  146. package/dist/isNil/index.d.ts +0 -1
  147. package/dist/isServer.d.ts +0 -2
  148. package/dist/isUrl/index.d.ts +0 -6
  149. package/dist/merge/useDeepMege.d.ts +0 -43
  150. package/dist/nanoid/index.d.ts +0 -6
  151. package/dist/omitBoolean/index.d.ts +0 -6
  152. package/dist/omitUndefined/index.d.ts +0 -2
  153. package/dist/omitUndefinedAndEmptyArr/index.d.ts +0 -1
  154. package/dist/pro-utils.umd.cjs +0 -13
  155. package/dist/scroll/easings.d.ts +0 -1
  156. package/dist/scroll/getScroll.d.ts +0 -2
  157. package/dist/scroll/index.d.ts +0 -4
  158. package/dist/scroll/scrollTo.d.ts +0 -10
  159. package/dist/scroll/throttleByAnimationFrame.d.ts +0 -5
  160. package/dist/slots/index.d.ts +0 -68
  161. package/dist/typings/index.d.ts +0 -40
  162. package/dist/utils/config.d.ts +0 -7
  163. package/dist/utils/getSymbols.d.ts +0 -1
  164. package/dist/utils/getTag.d.ts +0 -8
  165. package/dist/utils/index.d.ts +0 -333
  166. package/dist/utils/isEqual.d.ts +0 -9
  167. package/dist/utils/isNotNil.d.ts +0 -1
  168. package/dist/utils/isPlainObject.d.ts +0 -43
  169. package/dist/utils/isPrimitive.d.ts +0 -29
  170. package/dist/utils/isTypedArray.d.ts +0 -27
  171. package/dist/utils/isUnsafeProperty.d.ts +0 -11
  172. package/dist/utils/isValid.d.ts +0 -2
  173. package/dist/utils/raf.d.ts +0 -5
  174. package/dist/utils/tags.d.ts +0 -26
  175. package/dist/utils/validate.d.ts +0 -28
@@ -1,333 +0,0 @@
1
- import type { CSSProperties } from 'vue';
2
- import type { AlignType, BasicTablePageConfig, MaterialOptions, RecordType } from '../typings';
3
- import isValid from './isValid';
4
- import raf from './raf';
5
- import isEqual from './isEqual';
6
- export * from './config';
7
- export * from './getSymbols';
8
- export * from './isNotNil';
9
- export * from './isPlainObject';
10
- export * from './isPrimitive';
11
- export * from './isTypedArray';
12
- export * from './validate';
13
- export { isValid, raf, isEqual };
14
- export interface PrefixCls {
15
- suffixCls?: string;
16
- customizePrefixCls?: string;
17
- isPor?: boolean;
18
- className?: string;
19
- }
20
- export declare const getPrefixCls: ({ suffixCls, customizePrefixCls, isPor, className }: PrefixCls) => string;
21
- /**
22
- * 根据 key 和 dataIndex 生成唯一 id
23
- *
24
- * @param key 用户设置的 key
25
- * @param dataIndex 在对象中的数据
26
- * @param index 序列号,理论上唯一
27
- */
28
- export declare const genColumnKey: (key: string[] | number | string | undefined, index?: number) => string;
29
- /**
30
- * @Author gx12358
31
- * @DateTime 2025/2/5
32
- * @lastTime 2025/2/5
33
- * @description 这里是结合ant的数据结构给到的分页数据
34
- */
35
- export declare function handleShowIndex<T extends object>(columns: T[], { align, showIndex }: {
36
- align: AlignType;
37
- showIndex: boolean;
38
- }): T[];
39
- /**
40
- * @Author gx12358
41
- * @DateTime 2021/11/3
42
- * @lastTime 2021/11/3
43
- * @description 如果是个方法执行一下它
44
- */
45
- export declare function runFunction<T extends any[]>(valueEnum: any, ...rest: T): any;
46
- /**
47
- * @Author gx12358
48
- * @DateTime 2022/10/11
49
- * @lastTime 2022/10/11
50
- * @description 简单深拷贝下
51
- */
52
- export declare function deepCopy<T = RecordType>(data: any): T;
53
- /**
54
- * @Author gx12358
55
- * @DateTime 2021/1/28
56
- * @lastTime 2021/1/28
57
- * @description 判断删除是否到当前页最后一条
58
- */
59
- export declare function handleCurrentPage(pageConfig: BasicTablePageConfig, currentPage: number): number;
60
- /**
61
- * @Author gaoxiang
62
- * @DateTime 2020/7/24
63
- * @lastTime 2020/7/24
64
- * @description 数组(树形)添加序号
65
- */
66
- export declare function getSortIndex<T = RecordType>(data: T[] | undefined, pageConfig: BasicTablePageConfig, childrenKey?: keyof T): any[];
67
- export declare function arraySlice<T = RecordType>(data: T[], range: number | number[]): T[];
68
- /**
69
- * @Author gaoxiang
70
- * @DateTime 2019/11/29
71
- * @lastTime 2019/11/29
72
- * @description 这里是给到数组的sort的方法
73
- * @description 排序 sort 0 从小到大 1 从大到小
74
- */
75
- export declare function compareArray<T = RecordType>(obj1: T, obj2: T, key: keyof T, sort?: 0 | 1): number;
76
- /**
77
- * @Author gx12358
78
- * @DateTime 2023/10/17
79
- * @lastTime 2023/10/17
80
- * @description 这里是给到数组的sort的方法
81
- * @description type 0 从小到大 1 从大到小
82
- */
83
- export declare function compareTime<T = RecordType>(obj1: T, obj2: T, key: keyof T, sort?: 0 | 1): number;
84
- /**
85
- * @Author gx12358
86
- * @DateTime 2024/10/27
87
- * @lastTime 2024/10/27
88
- * @description type 0 从小到大 1 从大到小
89
- */
90
- export declare function compareArraySort<T = RecordType>(dataSource: T[], key: keyof T, sort?: 0 | 1): T[];
91
- /**
92
- * @Author gx12358
93
- * @DateTime 2024/10/27
94
- * @lastTime 2024/10/27
95
- * @description 比较时间 type 0 从小到大 1 从大到小
96
- */
97
- export declare function compareArrayTimeSort<T = RecordType>(dataSource: T[], key: keyof T, sort?: 0 | 1): T[];
98
- /**
99
- * @Author gaoxiang
100
- * @DateTime 2019/12/11
101
- * @lastTime 2019/12/11
102
- * @description 数组去重
103
- */
104
- export declare function arrayRepeat<T = RecordType>(data: T[]): T[];
105
- /**
106
- * @Author gaoxiang
107
- * @DateTime 2020/8/26
108
- * @lastTime 2020/8/26
109
- * @description 处理字段为空
110
- */
111
- export declare function handleEmptyField(str: any, customize: any): {
112
- success: boolean;
113
- value: any;
114
- };
115
- /**
116
- * @Author gaoxiang
117
- * @DateTime 2020/8/7
118
- * @lastTime 2020/8/7
119
- * @description 时长格式转换
120
- */
121
- export declare function formatDuration(time: number): string;
122
- /**
123
- * @Author gaoxiang
124
- * @DateTime 2019/11/29
125
- * @lastTime 2019/11/29
126
- * @description 随机uuid
127
- */
128
- export declare function getRandomNumber(): {
129
- uuid(len?: number, rad?: number): any;
130
- uuidFast(): string;
131
- uuidString(): string;
132
- uuidCompact(): string;
133
- };
134
- /**
135
- * @Author gx12358
136
- * @DateTime 2022/10/11
137
- * @lastTime 2022/10/11
138
- * @description 获取树形结构最深的层级数
139
- */
140
- export declare function getMaxFloor<T>(data: T[], childrenKey?: keyof T): number;
141
- /**
142
- * @Author gaoxiang
143
- * @DateTime 2020/8/10
144
- * @lastTime 2020/8/10
145
- * @description 树形转平级
146
- */
147
- export declare function getLevelData<T extends RecordType = RecordType>(data: T[], filed?: keyof T): T[];
148
- /**
149
- * 构造树型结构数据
150
- * @param {*} source 数据源
151
- * @param {*} id id字段 默认 'id'
152
- * @param {*} parentId 父节点字段 默认 'parentId'
153
- * @param {*} children 孩子节点字段 默认 'children'
154
- * @param {*} rootId 根Id 默认 0
155
- */
156
- export declare function treeData<T extends RecordType = RecordType>(source: T[], options?: {
157
- id?: keyof T;
158
- parentId?: keyof T;
159
- children?: keyof T;
160
- rootId?: number | false;
161
- emptyChildren?: boolean;
162
- }): T[];
163
- /**
164
- * @Author gx12358
165
- * @DateTime 2024/12/21
166
- * @lastTime 2024/12/21
167
- * @description 树形数组 按照条件 过滤
168
- */
169
- export declare function filterTree<T = any>(tree: T[], predicate: (val: T) => boolean): any[];
170
- /**
171
- * @Author gx12358
172
- * @DateTime 2024/12/21
173
- * @lastTime 2024/12/21
174
- * @description 给定指定的value值,找到其所有的祖先节点
175
- */
176
- export declare function findValueAndAncestors<T = any>(tree: T[], targetValue: any, fieldNames?: {
177
- value: 'value';
178
- children: 'children';
179
- }): any[];
180
- export declare function getArrayLast<T = any>(data: any): T;
181
- /**
182
- * @Author gx12358
183
- * @DateTime 2024/12/6
184
- * @lastTime 2024/12/6
185
- * @description 树形数组递归查找指定对象
186
- */
187
- export declare function findSourceByTree<T>(tree: T[], value: any, options?: {
188
- value: keyof T;
189
- children: keyof T;
190
- }): T | undefined;
191
- /**
192
- * @Author gx12358
193
- * @DateTime 2021/11/5
194
- * @lastTime 2021/11/5
195
- * @description blob对象转blob字符串
196
- */
197
- export declare function getBlobUrl(blob: Blob): string;
198
- /**
199
- * @Author gaoxiang
200
- * @DateTime 2020/7/25
201
- * @lastTime 2020/7/25
202
- * @description 获取图片base64码
203
- */
204
- export declare function getBase64(file: File): Promise<string | ArrayBuffer | null>;
205
- /**
206
- * @Author gx12358
207
- * @DateTime 2021/1/21
208
- * @lastTime 2021/1/21
209
- * @description base转blob对象
210
- */
211
- export declare function dataURLtoBlob(url: any): Blob;
212
- /**
213
- * @Author gaoxiang
214
- * @DateTime 2020/10/26
215
- * @lastTime 2020/10/26
216
- * @description base64码转file文件
217
- */
218
- export declare function dataURLtoFile(url: string, filename: string): File;
219
- /**
220
- * @Author gaoxiang
221
- * @DateTime 2020/10/26
222
- * @lastTime 2020/10/26
223
- * @description blob转file对象
224
- */
225
- export declare function blobToDataURL(blob: Blob, fileName: string, fileType: string): File;
226
- /**
227
- * @Author gaoxiang
228
- * @DateTime 2020/11/13
229
- * @lastTime 2020/11/13
230
- * @description 截取视频时间戳
231
- */
232
- export declare function getVideoFileUrl(url: string): string;
233
- /**
234
- * @Author gaoxiang
235
- * @DateTime 2020/11/13
236
- * @lastTime 2020/11/13
237
- * @description 获取文件后缀名
238
- */
239
- export declare function getFileSuffix(url: string): string;
240
- /**
241
- * @Author gaoxiang
242
- * @DateTime 2020/10/5
243
- * @lastTime 2020/10/5
244
- * @description 判断文件后缀名 1 图片 2 音频 3 视频 4 其他文件
245
- */
246
- export declare function checkFileType(url: any, type?: '1' | '2' | '3' | '4'): "1" | "2" | "3" | "4";
247
- /**
248
- * @Author gaoxiang
249
- * @DateTime 2020/11/13
250
- * @lastTime 2020/11/13
251
- * @description 获取文件信息(支持链接地址,file文件,base64编码)
252
- */
253
- export declare function getMediaInfos(mediaInfo: {
254
- url: any;
255
- fileType?: string;
256
- }): Promise<MaterialOptions>;
257
- /**
258
- * @Author gaoxiang
259
- * @DateTime 2020/11/13
260
- * @lastTime 2020/11/13
261
- * @description 获取视频封面图(支持链接地址,file文件,base64编码)
262
- */
263
- export declare function getVideoCoverPicture(videoInfo: {
264
- url: any;
265
- currentTime?: number;
266
- videoSuffix?: string;
267
- videoAllowPlay?: boolean;
268
- }): Promise<string>;
269
- /**
270
- * @Author gx12358
271
- * @DateTime 2022/8/4
272
- * @lastTime 2022/8/4
273
- * @description 直接获取视频地址
274
- */
275
- export declare function generateVideoPicture(videoUrl: string, currentTime?: number): Promise<string>;
276
- /**
277
- * @Author gx12358
278
- * @DateTime 2022/8/4
279
- * @lastTime 2022/8/4
280
- * @description 判断是否是base64码
281
- */
282
- export declare function isBase64(str?: string): boolean;
283
- export declare function isDataURLBase64(str: string): boolean;
284
- export declare function on(element: HTMLElement | Document | Window | null, event: string, handler: EventListenerOrEventListenerObject, useCapture?: boolean): void;
285
- export declare function off(element: HTMLElement | Document | Window | null, event: string, handler: EventListenerOrEventListenerObject, useCapture?: boolean): void;
286
- /**
287
- * 检查当前运行环境是否为Windows OS。
288
- *
289
- * 这个函数通过检查navigator.userAgent字符串来判断当前运行环境。
290
- * 如果userAgent字符串中包含"windows"或"win32"(不区分大小写),则认为当前环境是Windows OS。
291
- *
292
- * @returns {boolean} 如果当前环境是Windows OS,返回true,否则返回false。
293
- */
294
- export declare function isWindowsOs(): boolean;
295
- export declare function convertValueBoolean(value: any): boolean;
296
- export declare function formatNumber(fixedNum: number, value: number): string;
297
- /**
298
- * @Author gx12358
299
- * @DateTime 2022/6/20
300
- * @lastTime 2022/6/20
301
- * @description 转换数字
302
- */
303
- export declare function toConvertNumberShow(number: number, options?: {
304
- toChinese?: boolean;
305
- fixed?: number;
306
- min?: number;
307
- }): {
308
- str: string;
309
- number: string;
310
- unit?: string;
311
- };
312
- /**
313
- * @Author gx12358
314
- * @DateTime 2022/9/13
315
- * @lastTime 2022/9/13
316
- * @description 获取字符宽度或高度
317
- */
318
- export declare function getTextWidth(str: string, options: {
319
- id?: string;
320
- type?: 'width' | 'height';
321
- createName?: string;
322
- removeAfter?: boolean;
323
- cssObject?: CSSProperties;
324
- }): number;
325
- /**
326
- * @Author gx12358
327
- * @DateTime 2022/8/4
328
- * @lastTime 2022/8/4
329
- * @description 数字转中文
330
- */
331
- export declare function toChinesNum(num: number): string;
332
- export declare function forInObject<T extends object>(obj: T, callback: (key: keyof T, value: T[keyof T]) => void): void;
333
- export declare function keysOf<T extends object>(obj: T): (keyof T)[];
@@ -1,9 +0,0 @@
1
- /**
2
- * Deeply compares two object literals.
3
- * @param obj1 object 1
4
- * @param obj2 object 2
5
- * @param shallow shallow compare
6
- * @returns
7
- */
8
- declare function isEqual(obj1: any, obj2: any, shallow?: boolean): boolean;
9
- export default isEqual;
@@ -1 +0,0 @@
1
- export declare function isNotNil<T>(x: T | null | undefined): x is T;
@@ -1,43 +0,0 @@
1
- /**
2
- * Checks if a given value is a plain object.
3
- *
4
- * @param {object} value - The value to check.
5
- * @returns {value is Record<PropertyKey, any>} - True if the value is a plain object, otherwise false.
6
- *
7
- * @example
8
- * ```typescript
9
- * // ✅👇 True
10
- *
11
- * isPlainObject({ }); // ✅
12
- * isPlainObject({ key: 'value' }); // ✅
13
- * isPlainObject({ key: new Date() }); // ✅
14
- * isPlainObject(new Object()); // ✅
15
- * isPlainObject(Object.create(null)); // ✅
16
- * isPlainObject({ nested: { key: true} }); // ✅
17
- * isPlainObject(new Proxy({}, {})); // ✅
18
- * isPlainObject({ [Symbol('tag')]: 'A' }); // ✅
19
- *
20
- * // ✅👇 (cross-realms, node context, workers, ...)
21
- * const runInNewContext = await import('node:vm').then(
22
- * (mod) => mod.runInNewContext
23
- * );
24
- * isPlainObject(runInNewContext('({})')); // ✅
25
- *
26
- * // ❌👇 False
27
- *
28
- * class Test { };
29
- * isPlainObject(new Test()) // ❌
30
- * isPlainObject(10); // ❌
31
- * isPlainObject(null); // ❌
32
- * isPlainObject('hello'); // ❌
33
- * isPlainObject([]); // ❌
34
- * isPlainObject(new Date()); // ❌
35
- * isPlainObject(new Uint8Array([1])); // ❌
36
- * isPlainObject(Buffer.from('ABC')); // ❌
37
- * isPlainObject(Promise.resolve({})); // ❌
38
- * isPlainObject(Object.create({})); // ❌
39
- * isPlainObject(new (class Cls {})); // ❌
40
- * isPlainObject(globalThis); // ❌,
41
- * ```
42
- */
43
- export declare function isPlainObject(value: unknown): value is Record<PropertyKey, any>;
@@ -1,29 +0,0 @@
1
- /**
2
- * Checks whether a value is a JavaScript primitive.
3
- * JavaScript primitives include null, undefined, strings, numbers, booleans, symbols, and bigints.
4
- *
5
- * @param {unknown} value The value to check.
6
- * @returns {value is
7
- * null
8
- * | undefined
9
- * | string
10
- * | number
11
- * | boolean
12
- * | symbol
13
- * | bigint} Returns true if `value` is a primitive, false otherwise.
14
- *
15
- * @example
16
- * isPrimitive(null); // true
17
- * isPrimitive(undefined); // true
18
- * isPrimitive('123'); // true
19
- * isPrimitive(false); // true
20
- * isPrimitive(true); // true
21
- * isPrimitive(Symbol('a')); // true
22
- * isPrimitive(123n); // true
23
- * isPrimitive({}); // false
24
- * isPrimitive(new Date()); // false
25
- * isPrimitive(new Map()); // false
26
- * isPrimitive(new Set()); // false
27
- * isPrimitive([1, 2, 3]); // false
28
- */
29
- export declare function isPrimitive(value: unknown): value is null | undefined | string | number | boolean | symbol | bigint;
@@ -1,27 +0,0 @@
1
- /**
2
- * Checks if a value is a TypedArray.
3
- * @param {unknown} x The value to check.
4
- * @returns {x is
5
- * Uint8Array
6
- * | Uint8ClampedArray
7
- * | Uint16Array
8
- * | Uint32Array
9
- * | BigUint64Array
10
- * | Int8Array
11
- * | Int16Array
12
- * | Int32Array
13
- * | BigInt64Array
14
- * | Float32Array
15
- * | Float64Array} Returns true if `x` is a TypedArray, false otherwise.
16
- *
17
- * @example
18
- * const arr = new Uint8Array([1, 2, 3]);
19
- * isTypedArray(arr); // true
20
- *
21
- * const regularArray = [1, 2, 3];
22
- * isTypedArray(regularArray); // false
23
- *
24
- * const buffer = new ArrayBuffer(16);
25
- * isTypedArray(buffer); // false
26
- */
27
- export declare function isTypedArray(x: unknown): x is Uint8Array | Uint8ClampedArray | Uint16Array | Uint32Array | BigUint64Array | Int8Array | Int16Array | Int32Array | BigInt64Array | Float32Array | Float64Array;
@@ -1,11 +0,0 @@
1
- /**
2
- * Checks if a property key is unsafe to modify directly.
3
- *
4
- * This function is used in functions like `merge` to prevent prototype pollution attacks
5
- * by identifying property keys that could modify the object's prototype chain or constructor.
6
- *
7
- * @param key - The property key to check
8
- * @returns `true` if the property is unsafe to modify directly, `false` otherwise
9
- * @internal
10
- */
11
- export declare function isUnsafeProperty(key: PropertyKey): key is "__proto__";
@@ -1,2 +0,0 @@
1
- declare const isValid: (value: any) => boolean;
2
- export default isValid;
@@ -1,5 +0,0 @@
1
- declare function wrapperRaf(callback: () => void, times?: number): number;
2
- declare namespace wrapperRaf {
3
- var cancel: (id: number) => void;
4
- }
5
- export default wrapperRaf;
@@ -1,26 +0,0 @@
1
- export declare const regexpTag = "[object RegExp]";
2
- export declare const stringTag = "[object String]";
3
- export declare const numberTag = "[object Number]";
4
- export declare const booleanTag = "[object Boolean]";
5
- export declare const argumentsTag = "[object Arguments]";
6
- export declare const symbolTag = "[object Symbol]";
7
- export declare const dateTag = "[object Date]";
8
- export declare const mapTag = "[object Map]";
9
- export declare const setTag = "[object Set]";
10
- export declare const arrayTag = "[object Array]";
11
- export declare const functionTag = "[object Function]";
12
- export declare const arrayBufferTag = "[object ArrayBuffer]";
13
- export declare const objectTag = "[object Object]";
14
- export declare const errorTag = "[object Error]";
15
- export declare const dataViewTag = "[object DataView]";
16
- export declare const uint8ArrayTag = "[object Uint8Array]";
17
- export declare const uint8ClampedArrayTag = "[object Uint8ClampedArray]";
18
- export declare const uint16ArrayTag = "[object Uint16Array]";
19
- export declare const uint32ArrayTag = "[object Uint32Array]";
20
- export declare const bigUint64ArrayTag = "[object BigUint64Array]";
21
- export declare const int8ArrayTag = "[object Int8Array]";
22
- export declare const int16ArrayTag = "[object Int16Array]";
23
- export declare const int32ArrayTag = "[object Int32Array]";
24
- export declare const bigInt64ArrayTag = "[object BigInt64Array]";
25
- export declare const float32ArrayTag = "[object Float32Array]";
26
- export declare const float64ArrayTag = "[object Float64Array]";
@@ -1,28 +0,0 @@
1
- export declare function is(val: unknown, type: string): boolean;
2
- export declare function isBoolean(val: unknown): val is boolean;
3
- export declare function isNumber(val: unknown): val is number;
4
- /**
5
- * @author gx12358 gx12358@gmail.com
6
- * @description 判断是否是数组
7
- * @param val
8
- * @returns {val is any[]|boolean}
9
- */
10
- export declare function isArray(val: any): val is Array<any>;
11
- /**
12
- * @Author gaoxiang
13
- * @DateTime 2019/11/29
14
- * @lastTime 2019/11/29
15
- * @description 是否是对象
16
- */
17
- export declare function isObject(val: any): val is Record<any, any>;
18
- /**
19
- * @author gx12358 gx12358@gmail.com
20
- * @description 判断是否是字符串
21
- * @param value
22
- * @returns {boolean}
23
- */
24
- export declare function isString(value: unknown): value is string;
25
- export declare function isFunction(func: unknown): func is (...args: any[]) => any;
26
- export declare function isJSONStr(str: any): boolean;
27
- export declare function isMobile(): boolean;
28
- export declare function isTablet(): boolean;