@alibarbar/common 1.0.0
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/README.md +338 -0
- package/dist/algorithm.d.mts +66 -0
- package/dist/algorithm.d.ts +66 -0
- package/dist/algorithm.js +44 -0
- package/dist/algorithm.js.map +1 -0
- package/dist/algorithm.mjs +3 -0
- package/dist/algorithm.mjs.map +1 -0
- package/dist/array.d.mts +139 -0
- package/dist/array.d.ts +139 -0
- package/dist/array.js +84 -0
- package/dist/array.js.map +1 -0
- package/dist/array.mjs +3 -0
- package/dist/array.mjs.map +1 -0
- package/dist/chunk-27UDDVLZ.js +259 -0
- package/dist/chunk-27UDDVLZ.js.map +1 -0
- package/dist/chunk-2FFSQ573.mjs +138 -0
- package/dist/chunk-2FFSQ573.mjs.map +1 -0
- package/dist/chunk-4RGXV4SJ.js +106 -0
- package/dist/chunk-4RGXV4SJ.js.map +1 -0
- package/dist/chunk-56W6YECK.js +374 -0
- package/dist/chunk-56W6YECK.js.map +1 -0
- package/dist/chunk-5BGSUGTI.mjs +128 -0
- package/dist/chunk-5BGSUGTI.mjs.map +1 -0
- package/dist/chunk-7E6GELHJ.mjs +302 -0
- package/dist/chunk-7E6GELHJ.mjs.map +1 -0
- package/dist/chunk-7V5UQXIO.js +89 -0
- package/dist/chunk-7V5UQXIO.js.map +1 -0
- package/dist/chunk-A4SWQXX7.mjs +484 -0
- package/dist/chunk-A4SWQXX7.mjs.map +1 -0
- package/dist/chunk-ALDC6LRJ.mjs +85 -0
- package/dist/chunk-ALDC6LRJ.mjs.map +1 -0
- package/dist/chunk-BHCRFURU.js +491 -0
- package/dist/chunk-BHCRFURU.js.map +1 -0
- package/dist/chunk-D7CS5EKF.js +110 -0
- package/dist/chunk-D7CS5EKF.js.map +1 -0
- package/dist/chunk-DYBSRI7V.js +189 -0
- package/dist/chunk-DYBSRI7V.js.map +1 -0
- package/dist/chunk-F3LAGHPG.js +332 -0
- package/dist/chunk-F3LAGHPG.js.map +1 -0
- package/dist/chunk-HLDFI7R2.mjs +175 -0
- package/dist/chunk-HLDFI7R2.mjs.map +1 -0
- package/dist/chunk-HME2N3VY.mjs +354 -0
- package/dist/chunk-HME2N3VY.mjs.map +1 -0
- package/dist/chunk-I3L42475.js +145 -0
- package/dist/chunk-I3L42475.js.map +1 -0
- package/dist/chunk-JBLX27WD.mjs +240 -0
- package/dist/chunk-JBLX27WD.mjs.map +1 -0
- package/dist/chunk-JHZ7M2MR.mjs +133 -0
- package/dist/chunk-JHZ7M2MR.mjs.map +1 -0
- package/dist/chunk-JK2SE3I2.js +100 -0
- package/dist/chunk-JK2SE3I2.js.map +1 -0
- package/dist/chunk-JQZBPAPO.js +157 -0
- package/dist/chunk-JQZBPAPO.js.map +1 -0
- package/dist/chunk-JXYGC2C5.mjs +100 -0
- package/dist/chunk-JXYGC2C5.mjs.map +1 -0
- package/dist/chunk-KGFTD255.js +104 -0
- package/dist/chunk-KGFTD255.js.map +1 -0
- package/dist/chunk-LBHBNPNJ.mjs +148 -0
- package/dist/chunk-LBHBNPNJ.mjs.map +1 -0
- package/dist/chunk-LCXGZISK.js +158 -0
- package/dist/chunk-LCXGZISK.js.map +1 -0
- package/dist/chunk-LF4CILQS.mjs +87 -0
- package/dist/chunk-LF4CILQS.mjs.map +1 -0
- package/dist/chunk-MMR6XQNX.js +98 -0
- package/dist/chunk-MMR6XQNX.js.map +1 -0
- package/dist/chunk-NSSDYX2U.mjs +80 -0
- package/dist/chunk-NSSDYX2U.mjs.map +1 -0
- package/dist/chunk-O3O67R4I.js +143 -0
- package/dist/chunk-O3O67R4I.js.map +1 -0
- package/dist/chunk-OX5PLOWB.js +90 -0
- package/dist/chunk-OX5PLOWB.js.map +1 -0
- package/dist/chunk-PJ7UCTX4.mjs +362 -0
- package/dist/chunk-PJ7UCTX4.mjs.map +1 -0
- package/dist/chunk-QIBE7GVN.mjs +81 -0
- package/dist/chunk-QIBE7GVN.mjs.map +1 -0
- package/dist/chunk-QIOC54LQ.mjs +130 -0
- package/dist/chunk-QIOC54LQ.mjs.map +1 -0
- package/dist/chunk-QV6MIQ7H.mjs +328 -0
- package/dist/chunk-QV6MIQ7H.mjs.map +1 -0
- package/dist/chunk-TQN37HIN.js +94 -0
- package/dist/chunk-TQN37HIN.js.map +1 -0
- package/dist/chunk-XJTZDXSR.mjs +94 -0
- package/dist/chunk-XJTZDXSR.mjs.map +1 -0
- package/dist/chunk-XVUE53T3.js +361 -0
- package/dist/chunk-XVUE53T3.js.map +1 -0
- package/dist/chunk-Y364QIQH.js +139 -0
- package/dist/chunk-Y364QIQH.js.map +1 -0
- package/dist/chunk-YXM6Q4JS.mjs +94 -0
- package/dist/chunk-YXM6Q4JS.mjs.map +1 -0
- package/dist/chunk-ZDMFMUDR.js +309 -0
- package/dist/chunk-ZDMFMUDR.js.map +1 -0
- package/dist/chunk-ZVJ6NQUM.mjs +82 -0
- package/dist/chunk-ZVJ6NQUM.mjs.map +1 -0
- package/dist/color.d.mts +74 -0
- package/dist/color.d.ts +74 -0
- package/dist/color.js +40 -0
- package/dist/color.js.map +1 -0
- package/dist/color.mjs +3 -0
- package/dist/color.mjs.map +1 -0
- package/dist/crypto.d.mts +92 -0
- package/dist/crypto.d.ts +92 -0
- package/dist/crypto.js +60 -0
- package/dist/crypto.js.map +1 -0
- package/dist/crypto.mjs +3 -0
- package/dist/crypto.mjs.map +1 -0
- package/dist/data-structure.d.mts +213 -0
- package/dist/data-structure.d.ts +213 -0
- package/dist/data-structure.js +32 -0
- package/dist/data-structure.js.map +1 -0
- package/dist/data-structure.mjs +3 -0
- package/dist/data-structure.mjs.map +1 -0
- package/dist/date.d.mts +108 -0
- package/dist/date.d.ts +108 -0
- package/dist/date.js +72 -0
- package/dist/date.js.map +1 -0
- package/dist/date.mjs +3 -0
- package/dist/date.mjs.map +1 -0
- package/dist/dom.d.mts +92 -0
- package/dist/dom.d.ts +92 -0
- package/dist/dom.js +56 -0
- package/dist/dom.js.map +1 -0
- package/dist/dom.mjs +3 -0
- package/dist/dom.mjs.map +1 -0
- package/dist/file.d.mts +44 -0
- package/dist/file.d.ts +44 -0
- package/dist/file.js +32 -0
- package/dist/file.js.map +1 -0
- package/dist/file.mjs +3 -0
- package/dist/file.mjs.map +1 -0
- package/dist/i18n.d.mts +77 -0
- package/dist/i18n.d.ts +77 -0
- package/dist/i18n.js +40 -0
- package/dist/i18n.js.map +1 -0
- package/dist/i18n.mjs +3 -0
- package/dist/i18n.mjs.map +1 -0
- package/dist/index.d.mts +155 -0
- package/dist/index.d.ts +155 -0
- package/dist/index.js +839 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +22 -0
- package/dist/index.mjs.map +1 -0
- package/dist/network.d.mts +47 -0
- package/dist/network.d.ts +47 -0
- package/dist/network.js +28 -0
- package/dist/network.js.map +1 -0
- package/dist/network.mjs +3 -0
- package/dist/network.mjs.map +1 -0
- package/dist/number.d.mts +100 -0
- package/dist/number.d.ts +100 -0
- package/dist/number.js +56 -0
- package/dist/number.js.map +1 -0
- package/dist/number.mjs +3 -0
- package/dist/number.mjs.map +1 -0
- package/dist/object.d.mts +132 -0
- package/dist/object.d.ts +132 -0
- package/dist/object.js +80 -0
- package/dist/object.js.map +1 -0
- package/dist/object.mjs +3 -0
- package/dist/object.mjs.map +1 -0
- package/dist/performance.d.mts +85 -0
- package/dist/performance.d.ts +85 -0
- package/dist/performance.js +40 -0
- package/dist/performance.js.map +1 -0
- package/dist/performance.mjs +3 -0
- package/dist/performance.mjs.map +1 -0
- package/dist/storage.d.mts +176 -0
- package/dist/storage.d.ts +176 -0
- package/dist/storage.js +33 -0
- package/dist/storage.js.map +1 -0
- package/dist/storage.mjs +4 -0
- package/dist/storage.mjs.map +1 -0
- package/dist/string.d.mts +105 -0
- package/dist/string.d.ts +105 -0
- package/dist/string.js +68 -0
- package/dist/string.js.map +1 -0
- package/dist/string.mjs +3 -0
- package/dist/string.mjs.map +1 -0
- package/dist/tracking.d.mts +182 -0
- package/dist/tracking.d.ts +182 -0
- package/dist/tracking.js +52 -0
- package/dist/tracking.js.map +1 -0
- package/dist/tracking.mjs +3 -0
- package/dist/tracking.mjs.map +1 -0
- package/dist/transform.d.mts +53 -0
- package/dist/transform.d.ts +53 -0
- package/dist/transform.js +32 -0
- package/dist/transform.js.map +1 -0
- package/dist/transform.mjs +3 -0
- package/dist/transform.mjs.map +1 -0
- package/dist/upload-DzlQtUBc.d.mts +202 -0
- package/dist/upload-DzlQtUBc.d.ts +202 -0
- package/dist/upload.d.mts +1 -0
- package/dist/upload.d.ts +1 -0
- package/dist/upload.js +17 -0
- package/dist/upload.js.map +1 -0
- package/dist/upload.mjs +4 -0
- package/dist/upload.mjs.map +1 -0
- package/dist/url.d.mts +82 -0
- package/dist/url.d.ts +82 -0
- package/dist/url.js +44 -0
- package/dist/url.js.map +1 -0
- package/dist/url.mjs +3 -0
- package/dist/url.mjs.map +1 -0
- package/dist/validation.d.mts +83 -0
- package/dist/validation.d.ts +83 -0
- package/dist/validation.js +60 -0
- package/dist/validation.js.map +1 -0
- package/dist/validation.mjs +3 -0
- package/dist/validation.mjs.map +1 -0
- package/package.json +170 -0
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
export { camelCase, capitalize, escapeHtml, highlight, kebabCase, mask, maskEmail, maskPhone, pascalCase, removeAccents, slugify, snakeCase, template, truncate, unescapeHtml } from './string.mjs';
|
|
2
|
+
export { chunk, compact, difference, drop, dropWhile, findIndexBy, flatten, groupBy, intersection, partition, sample, shuffle, sortBy, take, takeWhile, union, unique, unzip, zip } from './array.mjs';
|
|
3
|
+
export { deepClone, deepMerge, defaults, get, invert, isEmptyObject, isEqual, keys, mapKeys, mapValues, merge, omit, omitBy, pick, pickBy, set, transform, values } from './object.mjs';
|
|
4
|
+
export { addDays, addMonths, addYears, diffDays, endOfDay, formatDate, getDateFormatByGMT, getQuarter, getRelativeTime, getTimeFromGMT, getWeekNumber, isToday, isWeekday, isWeekend, isYesterday, startOfDay } from './date.mjs';
|
|
5
|
+
export { isEmpty, isFloat, isInteger, isNumeric, isValidDomain, isValidEmail, isValidHexColor, isValidIP, isValidIdCard, isValidJSON, isValidPhone, isValidUUID, isValidUrl } from './validation.mjs';
|
|
6
|
+
export { ceil, clamp, floor, formatBytes, formatCurrency, formatNumber, isBetween, parseNumber, percent, random, round, toFixed } from './number.mjs';
|
|
7
|
+
export { ParsedUrl, buildUrl, getQueryParams, isAbsoluteUrl, joinUrl, normalizeUrl, parseUrl, removeQueryParams, setQueryParams, updateQueryParams } from './url.mjs';
|
|
8
|
+
export { HSL, RGB, contrast, darken, hexToRgb, hslToRgb, lighten, mix, rgbToHex, rgbToHsl } from './color.mjs';
|
|
9
|
+
export { CurrencyCode, Locale, TranslationDictionary, createTranslator, formatCurrencyI18n, formatDateI18n, formatNumberI18n, formatRelativeTime, getLocale, pluralize, translate } from './i18n.mjs';
|
|
10
|
+
export { calculateBlobMD5, calculateFileMD5, formatFileSize, getFileExtension, getFileNameWithoutExtension, splitFileIntoChunks } from './file.mjs';
|
|
11
|
+
export { A as ApiResponse, h as ChunkInfo, b as ChunkUploadResponse, C as ChunkUploader, d as CompleteUploadResponse, U as UploadInitRequest, a as UploadInitResponse, f as UploadOptions, e as UploadProgress, g as UploadStatus, c as createUploader } from './upload-DzlQtUBc.mjs';
|
|
12
|
+
export { StorageOptions, cookie, getStorageKeyPair, localStorage, sessionStorage, setStorageKeyPair, storage } from './storage.mjs';
|
|
13
|
+
export { checkOnline, downloadFile, fetchWithRetry, fetchWithTimeout, request } from './network.mjs';
|
|
14
|
+
export { $, $$, addClass, copyToClipboard, getElementOffset, getScrollPosition, getStyle, isInViewport, removeClass, scrollTo, setStyle, toggleClass } from './dom.mjs';
|
|
15
|
+
export { csvToJson, jsonToCsv, jsonToXml, jsonToYaml, xmlToJson, yamlToJson } from './transform.mjs';
|
|
16
|
+
export { BinaryTree, DataQueue, Graph, LRUCache, LinkedList, Stack } from './data-structure.mjs';
|
|
17
|
+
export { binarySearch, bubbleSort, factorial, fibonacci, fibonacciSequence, gcd, lcm, mergeSort, quickSort } from './algorithm.mjs';
|
|
18
|
+
export { Queue, batch, debounce, memoize, once, retry, throttle, timeout } from './performance.mjs';
|
|
19
|
+
export { RSAKeyPair, base64Decode, base64Encode, exportPrivateKey, exportPublicKey, generateRSAKeyPair, generateRandomString, generateUUID, hash, importPrivateKey, importPublicKey, rsaDecrypt, rsaEncrypt, sha256 } from './crypto.mjs';
|
|
20
|
+
export { ExposureOptions, Tracker, TrackerOptions, TrackingEvent, TrackingEventType, createTracker, flush, getTracker, initTracker, setCommonParams, setUserInfo, trackClick, trackEvent, trackExposure, trackPageView } from './tracking.mjs';
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* 类型工具函数
|
|
24
|
+
*/
|
|
25
|
+
/**
|
|
26
|
+
* 提取函数参数类型
|
|
27
|
+
*/
|
|
28
|
+
type Parameters<T extends (...args: unknown[]) => unknown> = T extends (...args: infer P) => unknown ? P : never;
|
|
29
|
+
/**
|
|
30
|
+
* 提取函数返回类型
|
|
31
|
+
*/
|
|
32
|
+
type ReturnType<T extends (...args: unknown[]) => unknown> = T extends (...args: unknown[]) => infer R ? R : never;
|
|
33
|
+
/**
|
|
34
|
+
* 提取Promise的返回类型
|
|
35
|
+
*/
|
|
36
|
+
type Awaited<T> = T extends Promise<infer U> ? U : T;
|
|
37
|
+
/**
|
|
38
|
+
* 使所有属性可选(深度)
|
|
39
|
+
*/
|
|
40
|
+
type DeepPartial<T> = T extends object ? {
|
|
41
|
+
[P in keyof T]?: DeepPartial<T[P]>;
|
|
42
|
+
} : T;
|
|
43
|
+
/**
|
|
44
|
+
* 使所有属性必需(深度)
|
|
45
|
+
*/
|
|
46
|
+
type DeepRequired<T> = T extends object ? {
|
|
47
|
+
[P in keyof T]-?: DeepRequired<T[P]>;
|
|
48
|
+
} : T;
|
|
49
|
+
/**
|
|
50
|
+
* 使所有属性只读(深度)
|
|
51
|
+
*/
|
|
52
|
+
type DeepReadonly<T> = T extends object ? {
|
|
53
|
+
readonly [P in keyof T]: DeepReadonly<T[P]>;
|
|
54
|
+
} : T;
|
|
55
|
+
/**
|
|
56
|
+
* 提取对象的值类型
|
|
57
|
+
*/
|
|
58
|
+
type ValueOf<T> = T[keyof T];
|
|
59
|
+
/**
|
|
60
|
+
* 提取数组元素类型
|
|
61
|
+
*/
|
|
62
|
+
type ArrayElement<T> = T extends ReadonlyArray<infer U> ? U : never;
|
|
63
|
+
/**
|
|
64
|
+
* 排除null和undefined
|
|
65
|
+
*/
|
|
66
|
+
type NonNullable<T> = T extends null | undefined ? never : T;
|
|
67
|
+
/**
|
|
68
|
+
* 提取函数类型
|
|
69
|
+
*/
|
|
70
|
+
type FunctionType = (...args: unknown[]) => unknown;
|
|
71
|
+
/**
|
|
72
|
+
* 判断是否为函数类型
|
|
73
|
+
*/
|
|
74
|
+
type IsFunction<T> = T extends FunctionType ? true : false;
|
|
75
|
+
/**
|
|
76
|
+
* 提取对象中函数类型的键
|
|
77
|
+
*/
|
|
78
|
+
type FunctionKeys<T> = {
|
|
79
|
+
[K in keyof T]: T[K] extends FunctionType ? K : never;
|
|
80
|
+
}[keyof T];
|
|
81
|
+
/**
|
|
82
|
+
* 提取对象中非函数类型的键
|
|
83
|
+
*/
|
|
84
|
+
type NonFunctionKeys<T> = {
|
|
85
|
+
[K in keyof T]: T[K] extends FunctionType ? never : K;
|
|
86
|
+
}[keyof T];
|
|
87
|
+
/**
|
|
88
|
+
* 合并两个类型
|
|
89
|
+
*/
|
|
90
|
+
type Merge<T, U> = {
|
|
91
|
+
[K in keyof T | keyof U]: K extends keyof U ? U[K] : K extends keyof T ? T[K] : never;
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* 覆盖类型(U中的属性会覆盖T中的同名属性)
|
|
95
|
+
*/
|
|
96
|
+
type Overwrite<T, U> = Omit<T, keyof U> & U;
|
|
97
|
+
/**
|
|
98
|
+
* 必需属性
|
|
99
|
+
*/
|
|
100
|
+
type Required<T, K extends keyof T> = T & {
|
|
101
|
+
[P in K]-?: T[P];
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* 提取字符串字面量类型
|
|
105
|
+
*/
|
|
106
|
+
type StringLiteral<T> = T extends string ? T : never;
|
|
107
|
+
/**
|
|
108
|
+
* 提取数字字面量类型
|
|
109
|
+
*/
|
|
110
|
+
type NumberLiteral<T> = T extends number ? T : never;
|
|
111
|
+
/**
|
|
112
|
+
* 判断类型是否相等
|
|
113
|
+
*/
|
|
114
|
+
type Equals<X, Y> = (<T>() => T extends X ? 1 : 2) extends <T>() => T extends Y ? 1 : 2 ? true : false;
|
|
115
|
+
/**
|
|
116
|
+
* 判断类型是否为any
|
|
117
|
+
*/
|
|
118
|
+
type IsAny<T> = 0 extends 1 & T ? true : false;
|
|
119
|
+
/**
|
|
120
|
+
* 判断类型是否为never
|
|
121
|
+
*/
|
|
122
|
+
type IsNever<T> = [T] extends [never] ? true : false;
|
|
123
|
+
/**
|
|
124
|
+
* 判断类型是否为unknown
|
|
125
|
+
*/
|
|
126
|
+
type IsUnknown<T> = IsNever<T> extends false ? T extends unknown ? unknown extends T ? IsAny<T> extends false ? true : false : false : false : false;
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* 类型定义
|
|
130
|
+
*/
|
|
131
|
+
/**
|
|
132
|
+
* 通用函数类型
|
|
133
|
+
*/
|
|
134
|
+
type Func<T = any, R = any> = (...args: T[]) => R;
|
|
135
|
+
/**
|
|
136
|
+
* 异步函数类型
|
|
137
|
+
*/
|
|
138
|
+
type AsyncFunc<T = any, R = any> = (...args: T[]) => Promise<R>;
|
|
139
|
+
/**
|
|
140
|
+
* 可空类型
|
|
141
|
+
*/
|
|
142
|
+
type Nullable<T> = T | null;
|
|
143
|
+
/**
|
|
144
|
+
* 可选类型
|
|
145
|
+
*/
|
|
146
|
+
type Optional<T> = T | undefined;
|
|
147
|
+
/**
|
|
148
|
+
* 键值对类型
|
|
149
|
+
*/
|
|
150
|
+
type KeyValuePair<K = string, V = any> = {
|
|
151
|
+
key: K;
|
|
152
|
+
value: V;
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
export type { ArrayElement, AsyncFunc, Awaited, DeepPartial, DeepReadonly, DeepRequired, Equals, Func, FunctionKeys, FunctionType, IsAny, IsFunction, IsNever, IsUnknown, KeyValuePair, Merge, NonFunctionKeys, NonNullable, Nullable, NumberLiteral, Optional, Overwrite, Parameters, Required, ReturnType, StringLiteral, ValueOf };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
export { camelCase, capitalize, escapeHtml, highlight, kebabCase, mask, maskEmail, maskPhone, pascalCase, removeAccents, slugify, snakeCase, template, truncate, unescapeHtml } from './string.js';
|
|
2
|
+
export { chunk, compact, difference, drop, dropWhile, findIndexBy, flatten, groupBy, intersection, partition, sample, shuffle, sortBy, take, takeWhile, union, unique, unzip, zip } from './array.js';
|
|
3
|
+
export { deepClone, deepMerge, defaults, get, invert, isEmptyObject, isEqual, keys, mapKeys, mapValues, merge, omit, omitBy, pick, pickBy, set, transform, values } from './object.js';
|
|
4
|
+
export { addDays, addMonths, addYears, diffDays, endOfDay, formatDate, getDateFormatByGMT, getQuarter, getRelativeTime, getTimeFromGMT, getWeekNumber, isToday, isWeekday, isWeekend, isYesterday, startOfDay } from './date.js';
|
|
5
|
+
export { isEmpty, isFloat, isInteger, isNumeric, isValidDomain, isValidEmail, isValidHexColor, isValidIP, isValidIdCard, isValidJSON, isValidPhone, isValidUUID, isValidUrl } from './validation.js';
|
|
6
|
+
export { ceil, clamp, floor, formatBytes, formatCurrency, formatNumber, isBetween, parseNumber, percent, random, round, toFixed } from './number.js';
|
|
7
|
+
export { ParsedUrl, buildUrl, getQueryParams, isAbsoluteUrl, joinUrl, normalizeUrl, parseUrl, removeQueryParams, setQueryParams, updateQueryParams } from './url.js';
|
|
8
|
+
export { HSL, RGB, contrast, darken, hexToRgb, hslToRgb, lighten, mix, rgbToHex, rgbToHsl } from './color.js';
|
|
9
|
+
export { CurrencyCode, Locale, TranslationDictionary, createTranslator, formatCurrencyI18n, formatDateI18n, formatNumberI18n, formatRelativeTime, getLocale, pluralize, translate } from './i18n.js';
|
|
10
|
+
export { calculateBlobMD5, calculateFileMD5, formatFileSize, getFileExtension, getFileNameWithoutExtension, splitFileIntoChunks } from './file.js';
|
|
11
|
+
export { A as ApiResponse, h as ChunkInfo, b as ChunkUploadResponse, C as ChunkUploader, d as CompleteUploadResponse, U as UploadInitRequest, a as UploadInitResponse, f as UploadOptions, e as UploadProgress, g as UploadStatus, c as createUploader } from './upload-DzlQtUBc.js';
|
|
12
|
+
export { StorageOptions, cookie, getStorageKeyPair, localStorage, sessionStorage, setStorageKeyPair, storage } from './storage.js';
|
|
13
|
+
export { checkOnline, downloadFile, fetchWithRetry, fetchWithTimeout, request } from './network.js';
|
|
14
|
+
export { $, $$, addClass, copyToClipboard, getElementOffset, getScrollPosition, getStyle, isInViewport, removeClass, scrollTo, setStyle, toggleClass } from './dom.js';
|
|
15
|
+
export { csvToJson, jsonToCsv, jsonToXml, jsonToYaml, xmlToJson, yamlToJson } from './transform.js';
|
|
16
|
+
export { BinaryTree, DataQueue, Graph, LRUCache, LinkedList, Stack } from './data-structure.js';
|
|
17
|
+
export { binarySearch, bubbleSort, factorial, fibonacci, fibonacciSequence, gcd, lcm, mergeSort, quickSort } from './algorithm.js';
|
|
18
|
+
export { Queue, batch, debounce, memoize, once, retry, throttle, timeout } from './performance.js';
|
|
19
|
+
export { RSAKeyPair, base64Decode, base64Encode, exportPrivateKey, exportPublicKey, generateRSAKeyPair, generateRandomString, generateUUID, hash, importPrivateKey, importPublicKey, rsaDecrypt, rsaEncrypt, sha256 } from './crypto.js';
|
|
20
|
+
export { ExposureOptions, Tracker, TrackerOptions, TrackingEvent, TrackingEventType, createTracker, flush, getTracker, initTracker, setCommonParams, setUserInfo, trackClick, trackEvent, trackExposure, trackPageView } from './tracking.js';
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* 类型工具函数
|
|
24
|
+
*/
|
|
25
|
+
/**
|
|
26
|
+
* 提取函数参数类型
|
|
27
|
+
*/
|
|
28
|
+
type Parameters<T extends (...args: unknown[]) => unknown> = T extends (...args: infer P) => unknown ? P : never;
|
|
29
|
+
/**
|
|
30
|
+
* 提取函数返回类型
|
|
31
|
+
*/
|
|
32
|
+
type ReturnType<T extends (...args: unknown[]) => unknown> = T extends (...args: unknown[]) => infer R ? R : never;
|
|
33
|
+
/**
|
|
34
|
+
* 提取Promise的返回类型
|
|
35
|
+
*/
|
|
36
|
+
type Awaited<T> = T extends Promise<infer U> ? U : T;
|
|
37
|
+
/**
|
|
38
|
+
* 使所有属性可选(深度)
|
|
39
|
+
*/
|
|
40
|
+
type DeepPartial<T> = T extends object ? {
|
|
41
|
+
[P in keyof T]?: DeepPartial<T[P]>;
|
|
42
|
+
} : T;
|
|
43
|
+
/**
|
|
44
|
+
* 使所有属性必需(深度)
|
|
45
|
+
*/
|
|
46
|
+
type DeepRequired<T> = T extends object ? {
|
|
47
|
+
[P in keyof T]-?: DeepRequired<T[P]>;
|
|
48
|
+
} : T;
|
|
49
|
+
/**
|
|
50
|
+
* 使所有属性只读(深度)
|
|
51
|
+
*/
|
|
52
|
+
type DeepReadonly<T> = T extends object ? {
|
|
53
|
+
readonly [P in keyof T]: DeepReadonly<T[P]>;
|
|
54
|
+
} : T;
|
|
55
|
+
/**
|
|
56
|
+
* 提取对象的值类型
|
|
57
|
+
*/
|
|
58
|
+
type ValueOf<T> = T[keyof T];
|
|
59
|
+
/**
|
|
60
|
+
* 提取数组元素类型
|
|
61
|
+
*/
|
|
62
|
+
type ArrayElement<T> = T extends ReadonlyArray<infer U> ? U : never;
|
|
63
|
+
/**
|
|
64
|
+
* 排除null和undefined
|
|
65
|
+
*/
|
|
66
|
+
type NonNullable<T> = T extends null | undefined ? never : T;
|
|
67
|
+
/**
|
|
68
|
+
* 提取函数类型
|
|
69
|
+
*/
|
|
70
|
+
type FunctionType = (...args: unknown[]) => unknown;
|
|
71
|
+
/**
|
|
72
|
+
* 判断是否为函数类型
|
|
73
|
+
*/
|
|
74
|
+
type IsFunction<T> = T extends FunctionType ? true : false;
|
|
75
|
+
/**
|
|
76
|
+
* 提取对象中函数类型的键
|
|
77
|
+
*/
|
|
78
|
+
type FunctionKeys<T> = {
|
|
79
|
+
[K in keyof T]: T[K] extends FunctionType ? K : never;
|
|
80
|
+
}[keyof T];
|
|
81
|
+
/**
|
|
82
|
+
* 提取对象中非函数类型的键
|
|
83
|
+
*/
|
|
84
|
+
type NonFunctionKeys<T> = {
|
|
85
|
+
[K in keyof T]: T[K] extends FunctionType ? never : K;
|
|
86
|
+
}[keyof T];
|
|
87
|
+
/**
|
|
88
|
+
* 合并两个类型
|
|
89
|
+
*/
|
|
90
|
+
type Merge<T, U> = {
|
|
91
|
+
[K in keyof T | keyof U]: K extends keyof U ? U[K] : K extends keyof T ? T[K] : never;
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* 覆盖类型(U中的属性会覆盖T中的同名属性)
|
|
95
|
+
*/
|
|
96
|
+
type Overwrite<T, U> = Omit<T, keyof U> & U;
|
|
97
|
+
/**
|
|
98
|
+
* 必需属性
|
|
99
|
+
*/
|
|
100
|
+
type Required<T, K extends keyof T> = T & {
|
|
101
|
+
[P in K]-?: T[P];
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* 提取字符串字面量类型
|
|
105
|
+
*/
|
|
106
|
+
type StringLiteral<T> = T extends string ? T : never;
|
|
107
|
+
/**
|
|
108
|
+
* 提取数字字面量类型
|
|
109
|
+
*/
|
|
110
|
+
type NumberLiteral<T> = T extends number ? T : never;
|
|
111
|
+
/**
|
|
112
|
+
* 判断类型是否相等
|
|
113
|
+
*/
|
|
114
|
+
type Equals<X, Y> = (<T>() => T extends X ? 1 : 2) extends <T>() => T extends Y ? 1 : 2 ? true : false;
|
|
115
|
+
/**
|
|
116
|
+
* 判断类型是否为any
|
|
117
|
+
*/
|
|
118
|
+
type IsAny<T> = 0 extends 1 & T ? true : false;
|
|
119
|
+
/**
|
|
120
|
+
* 判断类型是否为never
|
|
121
|
+
*/
|
|
122
|
+
type IsNever<T> = [T] extends [never] ? true : false;
|
|
123
|
+
/**
|
|
124
|
+
* 判断类型是否为unknown
|
|
125
|
+
*/
|
|
126
|
+
type IsUnknown<T> = IsNever<T> extends false ? T extends unknown ? unknown extends T ? IsAny<T> extends false ? true : false : false : false : false;
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* 类型定义
|
|
130
|
+
*/
|
|
131
|
+
/**
|
|
132
|
+
* 通用函数类型
|
|
133
|
+
*/
|
|
134
|
+
type Func<T = any, R = any> = (...args: T[]) => R;
|
|
135
|
+
/**
|
|
136
|
+
* 异步函数类型
|
|
137
|
+
*/
|
|
138
|
+
type AsyncFunc<T = any, R = any> = (...args: T[]) => Promise<R>;
|
|
139
|
+
/**
|
|
140
|
+
* 可空类型
|
|
141
|
+
*/
|
|
142
|
+
type Nullable<T> = T | null;
|
|
143
|
+
/**
|
|
144
|
+
* 可选类型
|
|
145
|
+
*/
|
|
146
|
+
type Optional<T> = T | undefined;
|
|
147
|
+
/**
|
|
148
|
+
* 键值对类型
|
|
149
|
+
*/
|
|
150
|
+
type KeyValuePair<K = string, V = any> = {
|
|
151
|
+
key: K;
|
|
152
|
+
value: V;
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
export type { ArrayElement, AsyncFunc, Awaited, DeepPartial, DeepReadonly, DeepRequired, Equals, Func, FunctionKeys, FunctionType, IsAny, IsFunction, IsNever, IsUnknown, KeyValuePair, Merge, NonFunctionKeys, NonNullable, Nullable, NumberLiteral, Optional, Overwrite, Parameters, Required, ReturnType, StringLiteral, ValueOf };
|