@wzyjs/utils 0.2.36 → 0.2.37
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/dist/ai/302/axios.d.ts +2 -0
- package/dist/ai/302/chat/index.d.ts +1 -0
- package/dist/ai/302/image/index.d.ts +1 -0
- package/dist/ai/302/image/midjourney.d.ts +2 -0
- package/dist/ai/302/index.d.ts +2 -0
- package/dist/ai/index.d.ts +3 -0
- package/dist/ai/keling/axios.d.ts +2 -0
- package/dist/ai/keling/index.d.ts +8 -0
- package/dist/ai/keling/utils.d.ts +4 -0
- package/dist/ai/midjourney/index.d.ts +1 -0
- package/dist/ai/midjourney/utils.d.ts +12 -0
- package/dist/browser/download.d.ts +1 -0
- package/dist/browser/element.d.ts +6 -0
- package/dist/browser/index.d.ts +8 -0
- package/dist/browser/other.d.ts +2 -0
- package/dist/browser/style.d.ts +10 -0
- package/dist/browser.cjs.js +21010 -0
- package/dist/browser.esm.js +21007 -0
- package/dist/common/antd.d.ts +11 -0
- package/dist/common/array.d.ts +3 -0
- package/dist/common/image.d.ts +1 -0
- package/dist/common/index.d.ts +13 -0
- package/dist/common/location.d.ts +8 -0
- package/dist/common/number.d.ts +5 -0
- package/dist/common/object.d.ts +10 -0
- package/dist/common/other.d.ts +4 -0
- package/dist/common/promise.d.ts +5 -0
- package/dist/common/string.d.ts +22 -0
- package/dist/node/file/index.d.ts +2 -0
- package/dist/node/index.d.ts +4 -0
- package/dist/node/mail/index.d.ts +1 -0
- package/dist/node/oss/index.d.ts +9 -0
- package/dist/node.cjs.js +97007 -0
- package/dist/{cjs/node.d.ts → node.d.ts} +1 -0
- package/dist/node.esm.js +96989 -0
- package/package.json +27 -25
- package/dist/cjs/browser/element.js +0 -59
- package/dist/cjs/browser/index.js +0 -66
- package/dist/cjs/browser/initHttpClient.js +0 -62
- package/dist/cjs/browser/other.js +0 -35
- package/dist/cjs/browser/style.js +0 -81
- package/dist/cjs/browser.js +0 -25
- package/dist/cjs/common/array.js +0 -68
- package/dist/cjs/common/classs.js +0 -36
- package/dist/cjs/common/dayjs.js +0 -70
- package/dist/cjs/common/index.d.ts +0 -13
- package/dist/cjs/common/index.js +0 -106
- package/dist/cjs/common/number.js +0 -69
- package/dist/cjs/common/object.js +0 -65
- package/dist/cjs/common/other.js +0 -129
- package/dist/cjs/common/string.js +0 -190
- package/dist/cjs/node/file/index.js +0 -58
- package/dist/cjs/node/index.js +0 -48
- package/dist/cjs/node/jsonFile/index.js +0 -75
- package/dist/cjs/node/mail/index.js +0 -67
- package/dist/cjs/node.js +0 -25
- package/dist/esm/browser/element.js +0 -43
- package/dist/esm/browser/index.js +0 -16
- package/dist/esm/browser/initHttpClient.js +0 -67
- package/dist/esm/browser/other.js +0 -28
- package/dist/esm/browser/style.js +0 -55
- package/dist/esm/browser.d.ts +0 -2
- package/dist/esm/browser.js +0 -2
- package/dist/esm/common/array.js +0 -65
- package/dist/esm/common/classs.js +0 -33
- package/dist/esm/common/dayjs.d.ts +0 -19
- package/dist/esm/common/dayjs.js +0 -29
- package/dist/esm/common/index.d.ts +0 -13
- package/dist/esm/common/index.js +0 -14
- package/dist/esm/common/number.js +0 -52
- package/dist/esm/common/object.js +0 -84
- package/dist/esm/common/other.js +0 -167
- package/dist/esm/common/string.js +0 -180
- package/dist/esm/node/file/index.js +0 -52
- package/dist/esm/node/index.js +0 -4
- package/dist/esm/node/jsonFile/index.js +0 -101
- package/dist/esm/node/mail/index.js +0 -48
- package/dist/esm/node.d.ts +0 -2
- package/dist/esm/node.js +0 -2
- /package/dist/{cjs/browser.d.ts → browser.d.ts} +0 -0
- /package/dist/{cjs/common → common}/dayjs.d.ts +0 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Option } from '@wzyjs/types';
|
|
2
|
+
export declare const options2valueEnum: (options: string[]) => {
|
|
3
|
+
[key: string]: {
|
|
4
|
+
text: string;
|
|
5
|
+
};
|
|
6
|
+
};
|
|
7
|
+
export declare const transformOptions: (inputArray?: string[] | Option[]) => Option[];
|
|
8
|
+
export declare const getColumns: (dataSource: any) => {
|
|
9
|
+
title: string;
|
|
10
|
+
dataIndex: string;
|
|
11
|
+
}[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function imageToBase64(url: string): Promise<string>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export { default as _ } from 'lodash';
|
|
2
|
+
export { default as axios } from 'axios';
|
|
3
|
+
export { default as json5 } from 'json5';
|
|
4
|
+
export { default as consola } from 'consola';
|
|
5
|
+
export * from 'zod';
|
|
6
|
+
export * from './string';
|
|
7
|
+
export * from './object';
|
|
8
|
+
export * from './other';
|
|
9
|
+
export * from './number';
|
|
10
|
+
export * from './array';
|
|
11
|
+
export * from './image';
|
|
12
|
+
export * from './location';
|
|
13
|
+
export { default as dayjs, Dayjs, Timezone } from './dayjs';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const url2Params: (url?: string) => {
|
|
2
|
+
[key: string]: string;
|
|
3
|
+
};
|
|
4
|
+
export declare const params2Url: (params: {
|
|
5
|
+
[key: string]: any;
|
|
6
|
+
}) => string;
|
|
7
|
+
export declare const setUrlParams: (key: string, value: any, keepName: string) => void;
|
|
8
|
+
export declare const urlGetPath: (url?: string) => string;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const getRandomNum: (min: number, max: number) => number;
|
|
2
|
+
export declare const limitDecimals: (v: string, num: number, isForce: boolean) => string;
|
|
3
|
+
export declare const getFileSize: (size: number) => string;
|
|
4
|
+
export declare const isValidNumber: (value: any) => boolean;
|
|
5
|
+
export declare const numberWithCommas: (x?: number | string) => string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const findItem: <I>(list: I[], attr: keyof I, value?: I[keyof I]) => I | undefined;
|
|
2
|
+
export declare const filterParams: (params: {
|
|
3
|
+
[key: string]: any;
|
|
4
|
+
}) => any;
|
|
5
|
+
export declare const watch: {
|
|
6
|
+
observe(obj: {
|
|
7
|
+
[key: string]: any;
|
|
8
|
+
}, key: string, watchFun: (value: any, val: any) => undefined): void;
|
|
9
|
+
setWatcher(data?: {}, watch?: any): void;
|
|
10
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const delay: (time?: number) => Promise<unknown>;
|
|
2
|
+
export declare const calcJsText: (expr: string, context: Record<string, any>) => any;
|
|
3
|
+
export declare const optionsToEnum: (options: any[], text: string, key: string) => any;
|
|
4
|
+
export declare const performDecimalOperation: (num1?: number, num2?: number, operator?: string) => number | undefined;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare const getChineseByStr: (str: string) => string;
|
|
2
|
+
export declare const getStrLength: (value: string) => number;
|
|
3
|
+
export declare const replaceAll: (str: string, searchValue: string, replaceValue: string) => string;
|
|
4
|
+
export declare const replaceByRules: (str: string, rules: [string, string][]) => string;
|
|
5
|
+
export declare const replaceByVariables: (prompt: string, variables?: {
|
|
6
|
+
[key: string]: string;
|
|
7
|
+
}) => string;
|
|
8
|
+
export declare const getType: (value: any) => any;
|
|
9
|
+
export declare const amount: (str: string) => string;
|
|
10
|
+
export declare const jsonParse: (value: string | object) => object;
|
|
11
|
+
export declare const isJson: (str: string) => boolean;
|
|
12
|
+
export declare const toString: (value: any) => string;
|
|
13
|
+
export declare const getRandomColor: () => string;
|
|
14
|
+
export declare const getRandomString: (length?: number) => string;
|
|
15
|
+
export declare const getChinese: (str: string) => string;
|
|
16
|
+
export declare const getSliceStr: (str: string, before: string, after: string) => string;
|
|
17
|
+
export declare const getProxyUrl: (url: string) => string;
|
|
18
|
+
export declare const getLength: (value: string) => number;
|
|
19
|
+
export declare const getCookie: (name: string) => string;
|
|
20
|
+
export declare const generateAlphabetArray: (n: number) => string[];
|
|
21
|
+
export declare const levenshteinDistance: (a: string, b: string) => number;
|
|
22
|
+
export declare const generateUniqueFileName: (name: string) => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const sendMail: (toEmail: string, title: string, content?: string) => Promise<string>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
type FileInput = string | Buffer;
|
|
2
|
+
/**
|
|
3
|
+
* 上传文件到 OSS
|
|
4
|
+
* @param file - 文件,可以是 HTTP URL、本地文件路径或 Buffer
|
|
5
|
+
* @param filename - 文件名,当 file 是 Buffer 时必须提供
|
|
6
|
+
* @returns 上传后的文件 URL
|
|
7
|
+
*/
|
|
8
|
+
export declare function uploadFile(file: FileInput, filename?: string): Promise<string>;
|
|
9
|
+
export {};
|