@vtj/utils 0.0.10 → 0.3.1-alpha.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/LICENSE +21 -0
- package/cdn/index.js +22 -0
- package/lib/index.js +4489 -0
- package/package.json +15 -33
- package/types/axios.d.ts +4 -0
- package/types/{src/cookie.d.ts → cookie.d.ts} +0 -0
- package/types/{src/crypto.d.ts → crypto.d.ts} +0 -0
- package/types/{src/dayjs.d.ts → dayjs.d.ts} +0 -0
- package/types/file.d.ts +10 -0
- package/types/index.d.ts +11 -4
- package/types/{src/jsonp.d.ts → jsonp.d.ts} +2 -1
- package/types/raf.d.ts +2 -0
- package/types/request.d.ts +47 -0
- package/types/{src/storage.d.ts → storage.d.ts} +0 -0
- package/types/{src/url.d.ts → url.d.ts} +0 -0
- package/types/util.d.ts +162 -0
- package/README.md +0 -3
- package/lib/cdn/index.cjs.js +0 -19
- package/lib/cdn/index.es.js +0 -3370
- package/lib/cdn/index.umd.js +0 -19
- package/lib/cdn/mock/test_jsonp.js +0 -3
- package/lib/index.cjs.js +0 -19
- package/lib/index.es.js +0 -3373
- package/lib/index.umd.js +0 -19
- package/lib/mock/test_jsonp.js +0 -3
- package/src/axios.ts +0 -3
- package/src/cookie.ts +0 -22
- package/src/crypto.ts +0 -6
- package/src/dayjs.ts +0 -4
- package/src/index.ts +0 -9
- package/src/jsonp.ts +0 -74
- package/src/request.ts +0 -347
- package/src/storage.ts +0 -143
- package/src/url.ts +0 -102
- package/src/util.ts +0 -77
- package/types/dev/vite-env.d.ts +0 -7
- package/types/src/axios.d.ts +0 -2
- package/types/src/index.d.ts +0 -9
- package/types/src/request.d.ts +0 -41
- package/types/src/util.d.ts +0 -24
- package/types/src/utils.d.ts +0 -3
package/types/src/request.d.ts
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
declare const instance: import("axios").AxiosInstance;
|
|
2
|
-
export interface ISettings {
|
|
3
|
-
loading?: boolean;
|
|
4
|
-
showLoading?: () => void;
|
|
5
|
-
hideLoading?: () => void;
|
|
6
|
-
loadingTime?: number;
|
|
7
|
-
type?: 'form' | 'json' | 'data';
|
|
8
|
-
originResponse?: boolean;
|
|
9
|
-
validSuccess?: boolean;
|
|
10
|
-
validate?: (res: any) => boolean;
|
|
11
|
-
failMessage?: boolean;
|
|
12
|
-
showError?: (msg: any) => void;
|
|
13
|
-
injectHeaders?: (options: IOptions) => Record<string, string>;
|
|
14
|
-
defaults?: Record<string, any>;
|
|
15
|
-
trim?: boolean;
|
|
16
|
-
picked?: boolean;
|
|
17
|
-
pickFilter?: (v: any) => boolean;
|
|
18
|
-
skipWarnResponseCode?: number;
|
|
19
|
-
skipWarnExecutor?: () => void;
|
|
20
|
-
skipWarnCallback?: () => void;
|
|
21
|
-
skipWarnFinally?: () => void;
|
|
22
|
-
skipWarn?: boolean;
|
|
23
|
-
}
|
|
24
|
-
declare const __settings__: ISettings;
|
|
25
|
-
export declare function setConfig(config: ISettings): void;
|
|
26
|
-
export interface IOptions {
|
|
27
|
-
url: string;
|
|
28
|
-
method?: 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH';
|
|
29
|
-
baseURL?: string;
|
|
30
|
-
headers?: Record<string, string>;
|
|
31
|
-
params?: any;
|
|
32
|
-
data?: any;
|
|
33
|
-
timeout?: number;
|
|
34
|
-
settings?: ISettings;
|
|
35
|
-
}
|
|
36
|
-
export declare type IApiOptions = string | IOptions;
|
|
37
|
-
declare function request(options: IOptions, currentSettings?: ISettings): Promise<unknown>;
|
|
38
|
-
export declare function createApi(options: IApiOptions): (data: any, currentOptions?: {}) => Promise<unknown>;
|
|
39
|
-
export declare function setRequest(success: any, fail?: any): any;
|
|
40
|
-
export declare function setResponse(success: any, fail?: any): any;
|
|
41
|
-
export { request, instance as axiosInstance, __settings__ as RequestSettings };
|
package/types/src/util.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export { get, set, isPlainObject, cloneDeep, merge, debounce, throttle, isEqual, camelCase, upperFirst, template } from 'lodash-es';
|
|
2
|
-
export declare function uid(): string;
|
|
3
|
-
export declare function isFunction(val: any): boolean;
|
|
4
|
-
/**
|
|
5
|
-
* 提取对象属性
|
|
6
|
-
* @param object
|
|
7
|
-
* @param filter
|
|
8
|
-
* @returns
|
|
9
|
-
*/
|
|
10
|
-
export declare function pick(object: Record<string, any>, filter?: (v: any) => boolean): Record<string, any>;
|
|
11
|
-
/**
|
|
12
|
-
* 递归对象或数组清除文本类型值的两边空格
|
|
13
|
-
* @param {Object|Array} obj
|
|
14
|
-
* @return {Object|Array}
|
|
15
|
-
*/
|
|
16
|
-
export declare function trim(obj: any): any;
|
|
17
|
-
/**
|
|
18
|
-
* 截取几位小数
|
|
19
|
-
* @param {number} value 浮点数
|
|
20
|
-
* @param {number} [number=2] 保留几位小数
|
|
21
|
-
* @param {boolean} [round] 是否四舍五入
|
|
22
|
-
* @returns {number}
|
|
23
|
-
*/
|
|
24
|
-
export declare function toFixed(value: number, number: number | undefined, round: boolean): number;
|
package/types/src/utils.d.ts
DELETED