@hysc/meeting 10.5.6 → 10.5.8
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/index.d.mts +37 -14
- package/dist/index.d.ts +37 -14
- package/dist/index.js +2 -2
- package/dist/index.mjs +2 -2
- package/package.json +1 -1
- package/umd/index.js +25 -0
- package/umd/src/BMChat/BMChatVM.d.ts +28 -0
- package/umd/src/BMChat/BMMessageInfo.d.ts +32 -0
- package/umd/src/BMRoom/BMLiveVM.d.ts +36 -0
- package/umd/src/BMRoom/BMRoom.d.ts +740 -0
- package/umd/src/BMRoom/BMRoomInfo.d.ts +222 -0
- package/umd/src/BMRoom/BMRoomVM.d.ts +329 -0
- package/umd/src/BMRoom/RoomEvent.d.ts +1 -0
- package/umd/src/BMStream/BMSpeaker.d.ts +26 -0
- package/umd/src/BMStream/BMStreamModel.d.ts +311 -0
- package/umd/src/BMStream/BMStreamModelVM.d.ts +281 -0
- package/umd/src/BMStream/getHTMLMediaStreamOptions.d.ts +35 -0
- package/umd/src/BMStream/sortStream.d.ts +30 -0
- package/umd/src/BMUser/BMUser.d.ts +173 -0
- package/umd/src/BMUser/BMUserVM.d.ts +188 -0
- package/umd/src/SingletonQueue/SingletonQueue.d.ts +16 -0
- package/umd/src/audioPlay/AudioPlay.d.ts +31 -0
- package/umd/src/bjy-common/function/debounce.d.ts +9 -0
- package/umd/src/bjy-common/function/execute.d.ts +9 -0
- package/umd/src/bjy-common/function/getErrorMessage.d.ts +1 -0
- package/umd/src/bjy-common/function/isDef.d.ts +1 -0
- package/umd/src/bjy-common/function/isNative.d.ts +1 -0
- package/umd/src/bjy-common/function/isUndef.d.ts +1 -0
- package/umd/src/bjy-common/function/nextTick.d.ts +2 -0
- package/umd/src/bjy-common/function/throttling.d.ts +9 -0
- package/umd/src/bjy-common/function/toNumber.d.ts +1 -0
- package/umd/src/bjy-common/function/toString.d.ts +1 -0
- package/umd/src/bjy-common/type/api.d.ts +66 -0
- package/umd/src/bjy-common/type/options.d.ts +7 -0
- package/umd/src/bjy-common/type/type.d.ts +90 -0
- package/umd/src/bjy-common/util/CustomEvent.d.ts +30 -0
- package/umd/src/bjy-common/util/Emitter.d.ts +57 -0
- package/umd/src/bjy-common/util/NextTask.d.ts +28 -0
- package/umd/src/bjy-common/util/Sleep.d.ts +14 -0
- package/umd/src/bjy-common/util/Timer.d.ts +13 -0
- package/umd/src/bjy-common/util/array.d.ts +96 -0
- package/umd/src/bjy-common/util/browser.d.ts +6 -0
- package/umd/src/bjy-common/util/constant.d.ts +50 -0
- package/umd/src/bjy-common/util/holder.d.ts +6 -0
- package/umd/src/bjy-common/util/is.d.ts +49 -0
- package/umd/src/bjy-common/util/keypath.d.ts +41 -0
- package/umd/src/bjy-common/util/logger.d.ts +42 -0
- package/umd/src/bjy-common/util/network.d.ts +4 -0
- package/umd/src/bjy-common/util/object.d.ts +83 -0
- package/umd/src/bjy-common/util/os.d.ts +14 -0
- package/umd/src/bjy-common/util/string.d.ts +102 -0
- package/umd/src/constants.d.ts +130 -0
- package/umd/src/error/RTCError.d.ts +20 -0
- package/umd/src/error/errorMap.d.ts +70 -0
- package/umd/src/error/errorType.d.ts +96 -0
- package/umd/src/handleEvent/attachEvents.d.ts +47 -0
- package/umd/src/handleEvent/brtcNetEvent.d.ts +9 -0
- package/umd/src/handleEvent/customMessageEvent.d.ts +2 -0
- package/umd/src/handleEvent/handleParticipantEvent.d.ts +24 -0
- package/umd/src/handleEvent/handleRoomEvent.d.ts +20 -0
- package/umd/src/handleEvent/messageEvent.d.ts +5 -0
- package/umd/src/handleEvent/pullUser.d.ts +7 -0
- package/umd/src/handleEvent/roomErrEvent.d.ts +9 -0
- package/umd/src/handleEvent/streamEvent.d.ts +22 -0
- package/umd/src/index.d.ts +13 -0
- package/umd/src/logger/logger.d.ts +86 -0
- package/umd/src/type/customStats.d.ts +129 -0
- package/umd/src/type/index.d.ts +9 -0
- package/umd/src/type/stream.d.ts +12 -0
- package/umd/src/type/user.d.ts +9 -0
- package/umd/src/util/PackLoss.d.ts +7 -0
- package/umd/src/util/Pqueue.d.ts +62 -0
- package/umd/src/util/Privileges.d.ts +20 -0
- package/umd/src/util/ReportCollector.d.ts +22 -0
- package/umd/src/util/Stutter.d.ts +19 -0
- package/umd/src/util/Thread.d.ts +12 -0
- package/umd/src/util/base64.d.ts +4 -0
- package/umd/src/util/benchmark.d.ts +1 -0
- package/umd/src/util/checkPermissions.d.ts +1 -0
- package/umd/src/util/checkSystemRequirements.d.ts +1 -0
- package/umd/src/util/constant.d.ts +67 -0
- package/umd/src/util/devices.d.ts +2 -0
- package/umd/src/util/emitter.d.ts +45 -0
- package/umd/src/util/formatUserId.d.ts +2 -0
- package/umd/src/util/is.d.ts +70 -0
- package/umd/src/util/peerToPeerProbe.d.ts +9 -0
- package/umd/src/util/request.d.ts +45 -0
- package/umd/src/util/roomUtils.d.ts +9 -0
- package/umd/src/util/sortUtils.d.ts +10 -0
- package/umd/src/util/util.d.ts +81 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { NativeListener } from '../type/type';
|
|
2
|
+
import { EmitterOptions } from '../type/options';
|
|
3
|
+
declare type Namespace = {
|
|
4
|
+
type: string;
|
|
5
|
+
ns?: string;
|
|
6
|
+
};
|
|
7
|
+
export default class Emitter {
|
|
8
|
+
/**
|
|
9
|
+
* 是否开启命名空间
|
|
10
|
+
*/
|
|
11
|
+
ns: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* 已注册的事件监听
|
|
14
|
+
*/
|
|
15
|
+
listeners: Record<string, EmitterOptions[]>;
|
|
16
|
+
/**
|
|
17
|
+
* 原生事件监听,一个事件对应一个 listener
|
|
18
|
+
*/
|
|
19
|
+
nativeListeners?: Record<string, NativeListener>;
|
|
20
|
+
constructor(ns?: boolean);
|
|
21
|
+
/**
|
|
22
|
+
* 发射事件
|
|
23
|
+
*
|
|
24
|
+
* @param type 事件名称或命名空间
|
|
25
|
+
* @param args 事件处理函数的参数列表
|
|
26
|
+
* @param filter 自定义过滤器
|
|
27
|
+
*/
|
|
28
|
+
fire(type: string | Namespace, args: any[] | void, filter?: (namespace: Namespace, args: any[] | void, options: EmitterOptions) => boolean | void): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* 注册监听
|
|
31
|
+
*
|
|
32
|
+
* @param type
|
|
33
|
+
* @param listener
|
|
34
|
+
*/
|
|
35
|
+
on(type: string | Namespace, listener: Function | EmitterOptions): void;
|
|
36
|
+
/**
|
|
37
|
+
* 取消监听
|
|
38
|
+
*
|
|
39
|
+
* @param type
|
|
40
|
+
* @param listener
|
|
41
|
+
*/
|
|
42
|
+
off(type?: string | Namespace, listener?: Function): void;
|
|
43
|
+
/**
|
|
44
|
+
* 是否已监听某个事件
|
|
45
|
+
*
|
|
46
|
+
* @param type
|
|
47
|
+
* @param listener
|
|
48
|
+
*/
|
|
49
|
+
has(type: string | Namespace, listener?: Function): boolean;
|
|
50
|
+
/**
|
|
51
|
+
* 把事件类型解析成命名空间格式
|
|
52
|
+
*
|
|
53
|
+
* @param type
|
|
54
|
+
*/
|
|
55
|
+
parse(type: string): Namespace;
|
|
56
|
+
}
|
|
57
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Task } from '../type/type';
|
|
2
|
+
export default class NextTask {
|
|
3
|
+
/**
|
|
4
|
+
* 全局单例
|
|
5
|
+
*/
|
|
6
|
+
static shared(): NextTask;
|
|
7
|
+
/**
|
|
8
|
+
* 异步队列
|
|
9
|
+
*/
|
|
10
|
+
tasks: Task[];
|
|
11
|
+
constructor();
|
|
12
|
+
/**
|
|
13
|
+
* 在队尾添加异步任务
|
|
14
|
+
*/
|
|
15
|
+
append(func: Function, context?: any): void;
|
|
16
|
+
/**
|
|
17
|
+
* 在队首添加异步任务
|
|
18
|
+
*/
|
|
19
|
+
prepend(func: Function, context?: any): void;
|
|
20
|
+
/**
|
|
21
|
+
* 清空异步队列
|
|
22
|
+
*/
|
|
23
|
+
clear(): void;
|
|
24
|
+
/**
|
|
25
|
+
* 立即执行异步任务,并清空队列
|
|
26
|
+
*/
|
|
27
|
+
run(): void;
|
|
28
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file 等待操作
|
|
3
|
+
* @author zhaogaoxing
|
|
4
|
+
*/
|
|
5
|
+
export default class Sleep {
|
|
6
|
+
private timeout;
|
|
7
|
+
private timer;
|
|
8
|
+
private resolve;
|
|
9
|
+
private reject;
|
|
10
|
+
private startTime;
|
|
11
|
+
constructor(timeout: number);
|
|
12
|
+
then(res: (value?: number) => void, rej: (value?: number) => void): void;
|
|
13
|
+
stop(reslove?: boolean): void;
|
|
14
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export default class Timer {
|
|
2
|
+
private task;
|
|
3
|
+
private timeout;
|
|
4
|
+
private interval;
|
|
5
|
+
private timer;
|
|
6
|
+
private count;
|
|
7
|
+
constructor(task: Function, timeout: number, interval: number);
|
|
8
|
+
start(): void;
|
|
9
|
+
stop(): void;
|
|
10
|
+
updateInterval(interval: number): void;
|
|
11
|
+
isStarted(): boolean;
|
|
12
|
+
destroy(): void;
|
|
13
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 遍历数组
|
|
3
|
+
*
|
|
4
|
+
* @param array
|
|
5
|
+
* @param callback 返回 false 可停止遍历
|
|
6
|
+
* @param reversed 是否逆序遍历
|
|
7
|
+
*/
|
|
8
|
+
export declare function each<T>(array: T[], callback: (item: T, index: number) => boolean | void, reversed?: boolean): void;
|
|
9
|
+
/**
|
|
10
|
+
* 往后加
|
|
11
|
+
*
|
|
12
|
+
* @param array
|
|
13
|
+
* @param target
|
|
14
|
+
*/
|
|
15
|
+
export declare function push<T>(array: T[], target: T | T[]): void;
|
|
16
|
+
/**
|
|
17
|
+
* 往前加
|
|
18
|
+
*
|
|
19
|
+
* @param array
|
|
20
|
+
* @param target
|
|
21
|
+
*/
|
|
22
|
+
export declare function unshift<T>(array: T[], target: T | T[]): void;
|
|
23
|
+
/**
|
|
24
|
+
* 数组项在数组中的位置
|
|
25
|
+
*
|
|
26
|
+
* @param array 数组
|
|
27
|
+
* @param target 数组项
|
|
28
|
+
* @param strict 是否全等判断,默认是全等
|
|
29
|
+
* @return 如果未找到,返回 -1
|
|
30
|
+
*/
|
|
31
|
+
export declare function indexOf<T>(array: T[], target: T, strict?: boolean): number;
|
|
32
|
+
/**
|
|
33
|
+
* 获取数组最后一项
|
|
34
|
+
*
|
|
35
|
+
* @param array 数组
|
|
36
|
+
* @return
|
|
37
|
+
*/
|
|
38
|
+
export declare function last<T>(array: T[]): T | void;
|
|
39
|
+
/**
|
|
40
|
+
* 弹出数组最后一项
|
|
41
|
+
*
|
|
42
|
+
* 项目里用的太多,仅用于节省字符...
|
|
43
|
+
*
|
|
44
|
+
* @param array 数组
|
|
45
|
+
* @return 弹出的数组项
|
|
46
|
+
*/
|
|
47
|
+
export declare function pop<T>(array: T[]): T | void;
|
|
48
|
+
/**
|
|
49
|
+
* 删除数组项
|
|
50
|
+
*
|
|
51
|
+
* @param array 数组
|
|
52
|
+
* @param item 待删除项
|
|
53
|
+
* @param strict 是否全等判断,默认是全等
|
|
54
|
+
* @return 删除的数量
|
|
55
|
+
*/
|
|
56
|
+
export declare function remove<T>(array: T[], target: T, strict?: boolean): number;
|
|
57
|
+
/**
|
|
58
|
+
* 数组是否包含 item
|
|
59
|
+
*
|
|
60
|
+
* @param array 数组
|
|
61
|
+
* @param target 可能包含的数组项
|
|
62
|
+
* @param strict 是否全等判断,默认是全等
|
|
63
|
+
* @return
|
|
64
|
+
*/
|
|
65
|
+
export declare function has<T>(array: T[], target: T, strict?: boolean): boolean;
|
|
66
|
+
/**
|
|
67
|
+
* 把类数组转成数组
|
|
68
|
+
*
|
|
69
|
+
* @param array 类数组
|
|
70
|
+
* @return
|
|
71
|
+
*/
|
|
72
|
+
export declare function toArray<T>(array: T[] | ArrayLike<T>): T[];
|
|
73
|
+
/**
|
|
74
|
+
* 把数组转成对象
|
|
75
|
+
*
|
|
76
|
+
* @param array 数组
|
|
77
|
+
* @param key 数组项包含的字段名称,如果数组项是基本类型,可不传
|
|
78
|
+
* @param value
|
|
79
|
+
* @return
|
|
80
|
+
*/
|
|
81
|
+
export declare function toObject(array: any[], key?: string | null, value?: any): object;
|
|
82
|
+
/**
|
|
83
|
+
* 把数组合并成字符串
|
|
84
|
+
*
|
|
85
|
+
* @param array
|
|
86
|
+
* @param separator
|
|
87
|
+
* @return
|
|
88
|
+
*/
|
|
89
|
+
export declare function join(array: string[], separator: string): string;
|
|
90
|
+
/**
|
|
91
|
+
* 用于判断长度大于 0 的数组
|
|
92
|
+
*
|
|
93
|
+
* @param array
|
|
94
|
+
* @return
|
|
95
|
+
*/
|
|
96
|
+
export declare function falsy(array: any): boolean;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 为了压缩,定义的常量
|
|
3
|
+
*/
|
|
4
|
+
export declare const TRUE = true;
|
|
5
|
+
export declare const FALSE = false;
|
|
6
|
+
export declare const NULL: null;
|
|
7
|
+
export declare const UNDEFINED: undefined;
|
|
8
|
+
export declare const MINUS_ONE = -1;
|
|
9
|
+
export declare const RAW_TRUE = "true";
|
|
10
|
+
export declare const RAW_FALSE = "false";
|
|
11
|
+
export declare const RAW_NULL = "null";
|
|
12
|
+
export declare const RAW_UNDEFINED = "undefined";
|
|
13
|
+
export declare const RAW_THIS = "this";
|
|
14
|
+
export declare const RAW_VALUE = "value";
|
|
15
|
+
export declare const RAW_LENGTH = "length";
|
|
16
|
+
export declare const RAW_FUNCTION = "function";
|
|
17
|
+
export declare const RAW_WILDCARD = "*";
|
|
18
|
+
export declare const RAW_DOT = ".";
|
|
19
|
+
export declare const RAW_SLASH = "/";
|
|
20
|
+
export declare const RAW_TAG = "tag";
|
|
21
|
+
export declare const KEYPATH_PARENT = "..";
|
|
22
|
+
export declare const KEYPATH_CURRENT = "this";
|
|
23
|
+
/**
|
|
24
|
+
* Single instance for window in browser
|
|
25
|
+
*/
|
|
26
|
+
export declare const WINDOW: (Window & typeof globalThis) | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* Single instance for document in browser
|
|
29
|
+
*/
|
|
30
|
+
export declare const DOCUMENT: Document | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* Single instance for global in nodejs or browser
|
|
33
|
+
*/
|
|
34
|
+
export declare const GLOBAL: typeof globalThis | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* Single instance for noop function
|
|
37
|
+
*/
|
|
38
|
+
export declare const EMPTY_FUNCTION: () => void;
|
|
39
|
+
/**
|
|
40
|
+
* 空对象,很多地方会用到,比如 `a || EMPTY_OBJECT` 确保是个对象
|
|
41
|
+
*/
|
|
42
|
+
export declare const EMPTY_OBJECT: Readonly<{}>;
|
|
43
|
+
/**
|
|
44
|
+
* 空数组
|
|
45
|
+
*/
|
|
46
|
+
export declare const EMPTY_ARRAY: readonly never[];
|
|
47
|
+
/**
|
|
48
|
+
* 空字符串
|
|
49
|
+
*/
|
|
50
|
+
export declare const EMPTY_STRING = "";
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Check if value is a function.
|
|
3
|
+
*
|
|
4
|
+
* @param value
|
|
5
|
+
* @return
|
|
6
|
+
*/
|
|
7
|
+
export declare function func(value: any): boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Check if value is an array.
|
|
10
|
+
*
|
|
11
|
+
* @param value
|
|
12
|
+
* @return
|
|
13
|
+
*/
|
|
14
|
+
export declare function array(value: any): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Check if value is an object.
|
|
17
|
+
*
|
|
18
|
+
* @param value
|
|
19
|
+
* @return
|
|
20
|
+
*/
|
|
21
|
+
export declare function object(value: any): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Check if value is a string.
|
|
24
|
+
*
|
|
25
|
+
* @param value
|
|
26
|
+
* @return
|
|
27
|
+
*/
|
|
28
|
+
export declare function string(value: any): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Check if value is a number.
|
|
31
|
+
*
|
|
32
|
+
* @param value
|
|
33
|
+
* @return
|
|
34
|
+
*/
|
|
35
|
+
export declare function number(value: any): boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Check if value is boolean.
|
|
38
|
+
*
|
|
39
|
+
* @param value
|
|
40
|
+
* @return
|
|
41
|
+
*/
|
|
42
|
+
export declare function boolean(value: any): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Check if value is numeric.
|
|
45
|
+
*
|
|
46
|
+
* @param value
|
|
47
|
+
* @return
|
|
48
|
+
*/
|
|
49
|
+
export declare function numeric(value: any): boolean;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 判断 keypath 是否以 prefix 开头,如果是,返回匹配上的前缀长度,否则返回 -1
|
|
3
|
+
*
|
|
4
|
+
* @param keypath
|
|
5
|
+
* @param prefix
|
|
6
|
+
* @return
|
|
7
|
+
*/
|
|
8
|
+
export declare function match(keypath: string, prefix: string): number;
|
|
9
|
+
/**
|
|
10
|
+
* 遍历 keypath 的每个部分
|
|
11
|
+
*
|
|
12
|
+
* @param keypath
|
|
13
|
+
* @param callback 返回 false 可中断遍历
|
|
14
|
+
*/
|
|
15
|
+
export declare function each(keypath: string, callback: (key: string, isLast: boolean) => boolean | void): void;
|
|
16
|
+
/**
|
|
17
|
+
* 路径组合
|
|
18
|
+
*
|
|
19
|
+
* @param keypath1
|
|
20
|
+
* @param keypath2
|
|
21
|
+
*/
|
|
22
|
+
export declare function join(keypath1: string, keypath2: string): string;
|
|
23
|
+
/**
|
|
24
|
+
* 是否模糊匹配
|
|
25
|
+
*
|
|
26
|
+
* @param keypath
|
|
27
|
+
*/
|
|
28
|
+
export declare function isFuzzy(keypath: string): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* 模糊匹配 keypath
|
|
31
|
+
*
|
|
32
|
+
* @param keypath
|
|
33
|
+
* @param pattern
|
|
34
|
+
*/
|
|
35
|
+
export declare function matchFuzzy(keypath: string, pattern: string): string | void;
|
|
36
|
+
/**
|
|
37
|
+
* 返回 keypath 的根路径
|
|
38
|
+
*
|
|
39
|
+
* @param keypath
|
|
40
|
+
*/
|
|
41
|
+
export declare function rootPath(keypath: string): string;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export declare const DEBUG = 1;
|
|
2
|
+
export declare const INFO = 2;
|
|
3
|
+
export declare const WARN = 3;
|
|
4
|
+
export declare const ERROR = 4;
|
|
5
|
+
export declare const FATAL = 5;
|
|
6
|
+
/**
|
|
7
|
+
* 打印 debug 日志
|
|
8
|
+
*
|
|
9
|
+
* @param msg
|
|
10
|
+
*/
|
|
11
|
+
export declare function debug(msg: string, tag?: string): void;
|
|
12
|
+
/**
|
|
13
|
+
* 打印 info 日志
|
|
14
|
+
*
|
|
15
|
+
* @param msg
|
|
16
|
+
*/
|
|
17
|
+
export declare function info(msg: string, tag?: string): void;
|
|
18
|
+
/**
|
|
19
|
+
* 打印 call 日志
|
|
20
|
+
*
|
|
21
|
+
* @param msg
|
|
22
|
+
* @param args
|
|
23
|
+
*/
|
|
24
|
+
export declare function call(msg: string, tag?: string, args?: any): void;
|
|
25
|
+
/**
|
|
26
|
+
* 打印 warn 日志
|
|
27
|
+
*
|
|
28
|
+
* @param msg
|
|
29
|
+
*/
|
|
30
|
+
export declare function warn(msg: string, tag?: string): void;
|
|
31
|
+
/**
|
|
32
|
+
* 打印 error 日志
|
|
33
|
+
*
|
|
34
|
+
* @param msg
|
|
35
|
+
*/
|
|
36
|
+
export declare function error(msg: string, tag?: string): void;
|
|
37
|
+
/**
|
|
38
|
+
* 致命错误,中断程序
|
|
39
|
+
*
|
|
40
|
+
* @param msg
|
|
41
|
+
*/
|
|
42
|
+
export declare function fatal(msg: string, tag?: string): void;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { Data } from '../type/type';
|
|
2
|
+
/**
|
|
3
|
+
* 获取对象的 key 的数组
|
|
4
|
+
*
|
|
5
|
+
* @param object
|
|
6
|
+
* @return
|
|
7
|
+
*/
|
|
8
|
+
export declare function keys(object: Data): string[];
|
|
9
|
+
/**
|
|
10
|
+
* 排序对象的 key
|
|
11
|
+
*
|
|
12
|
+
* @param object
|
|
13
|
+
* @param desc 是否逆序,默认从小到大排序
|
|
14
|
+
* @return
|
|
15
|
+
*/
|
|
16
|
+
export declare function sort(object: Data, desc?: boolean): string[];
|
|
17
|
+
/**
|
|
18
|
+
* 遍历对象
|
|
19
|
+
*
|
|
20
|
+
* @param object
|
|
21
|
+
* @param callback 返回 false 可停止遍历
|
|
22
|
+
*/
|
|
23
|
+
export declare function each<T>(object: Data, callback: (value: T, key: string) => boolean | void): void;
|
|
24
|
+
/**
|
|
25
|
+
* 清空对象所有的键值对
|
|
26
|
+
*
|
|
27
|
+
* @param object
|
|
28
|
+
*/
|
|
29
|
+
export declare function clear(object: Data): void;
|
|
30
|
+
/**
|
|
31
|
+
* 扩展对象
|
|
32
|
+
*
|
|
33
|
+
* @return
|
|
34
|
+
*/
|
|
35
|
+
export declare function extend(original: Data, object: Data): Data;
|
|
36
|
+
/**
|
|
37
|
+
* 合并对象
|
|
38
|
+
*
|
|
39
|
+
* @return
|
|
40
|
+
*/
|
|
41
|
+
export declare function merge(object1: Data | void, object2: Data | void): Data | void;
|
|
42
|
+
/**
|
|
43
|
+
* 拷贝对象
|
|
44
|
+
*
|
|
45
|
+
* @param object
|
|
46
|
+
* @param deep 是否需要深拷贝
|
|
47
|
+
* @return
|
|
48
|
+
*/
|
|
49
|
+
export declare function copy(object: any, deep?: boolean): any;
|
|
50
|
+
/**
|
|
51
|
+
* 从对象中查找一个 keypath
|
|
52
|
+
*
|
|
53
|
+
* 返回值是空时,表示没找到值
|
|
54
|
+
*
|
|
55
|
+
* @param object
|
|
56
|
+
* @param keypath
|
|
57
|
+
* @return
|
|
58
|
+
*/
|
|
59
|
+
export declare function get(object: any, keypath: string, defaultValue?: any): any;
|
|
60
|
+
/**
|
|
61
|
+
* 为对象设置一个键值对
|
|
62
|
+
*
|
|
63
|
+
* @param object
|
|
64
|
+
* @param keypath
|
|
65
|
+
* @param value
|
|
66
|
+
* @param autofill 是否自动填充不存在的对象,默认自动填充
|
|
67
|
+
*/
|
|
68
|
+
export declare function set(object: Data, keypath: string, value: any, autofill?: boolean): void;
|
|
69
|
+
/**
|
|
70
|
+
* 对象是否包含某个 key
|
|
71
|
+
*
|
|
72
|
+
* @param object
|
|
73
|
+
* @param key
|
|
74
|
+
* @return
|
|
75
|
+
*/
|
|
76
|
+
export declare function has(object: Data, key: string | number): boolean;
|
|
77
|
+
/**
|
|
78
|
+
* 是否是空对象
|
|
79
|
+
*
|
|
80
|
+
* @param object
|
|
81
|
+
* @return
|
|
82
|
+
*/
|
|
83
|
+
export declare function falsy(object: any): boolean;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 连字符转成驼峰
|
|
3
|
+
*
|
|
4
|
+
* @param str
|
|
5
|
+
* @return 驼峰格式的字符串
|
|
6
|
+
*/
|
|
7
|
+
export declare function camelize(str: string): string;
|
|
8
|
+
/**
|
|
9
|
+
* 驼峰转成连字符
|
|
10
|
+
*
|
|
11
|
+
* @param str
|
|
12
|
+
* @return 连字符格式的字符串
|
|
13
|
+
*/
|
|
14
|
+
export declare function hyphenate(str: string): string;
|
|
15
|
+
/**
|
|
16
|
+
* 首字母大写
|
|
17
|
+
*
|
|
18
|
+
* @param str
|
|
19
|
+
* @return
|
|
20
|
+
*/
|
|
21
|
+
export declare function capitalize(str: string): string;
|
|
22
|
+
/**
|
|
23
|
+
* 清除两侧空白符
|
|
24
|
+
*
|
|
25
|
+
* @param str
|
|
26
|
+
* @return 清除两侧空白符的字符串
|
|
27
|
+
*/
|
|
28
|
+
export declare function trim(str: any): string;
|
|
29
|
+
/**
|
|
30
|
+
* 截取字符串
|
|
31
|
+
*
|
|
32
|
+
* @param str
|
|
33
|
+
* @param start
|
|
34
|
+
* @param end
|
|
35
|
+
* @return
|
|
36
|
+
*/
|
|
37
|
+
export declare function slice(str: string, start: number, end?: number): string;
|
|
38
|
+
/**
|
|
39
|
+
* 获取子串的起始位置
|
|
40
|
+
*
|
|
41
|
+
* @param str
|
|
42
|
+
* @param part
|
|
43
|
+
* @param start
|
|
44
|
+
* @return
|
|
45
|
+
*/
|
|
46
|
+
export declare function indexOf(str: string, part: string, start?: number): number;
|
|
47
|
+
/**
|
|
48
|
+
* 获取子串的起始位置
|
|
49
|
+
*
|
|
50
|
+
* @param str
|
|
51
|
+
* @param part
|
|
52
|
+
* @param end
|
|
53
|
+
* @return
|
|
54
|
+
*/
|
|
55
|
+
export declare function lastIndexOf(str: string, part: string, end?: number): number;
|
|
56
|
+
/**
|
|
57
|
+
* str 是否以 part 开头
|
|
58
|
+
*
|
|
59
|
+
* @param str
|
|
60
|
+
* @param part
|
|
61
|
+
* @return
|
|
62
|
+
*/
|
|
63
|
+
export declare function startsWith(str: string, part: string): boolean;
|
|
64
|
+
/**
|
|
65
|
+
* str 是否以 part 结束
|
|
66
|
+
*
|
|
67
|
+
* @param str
|
|
68
|
+
* @param part
|
|
69
|
+
* @return
|
|
70
|
+
*/
|
|
71
|
+
export declare function endsWith(str: string, part: string): boolean;
|
|
72
|
+
/**
|
|
73
|
+
* 获取某个位置的字符
|
|
74
|
+
*/
|
|
75
|
+
export declare function charAt(str: string, index?: number): string;
|
|
76
|
+
/**
|
|
77
|
+
* 获取某个位置的字符编码
|
|
78
|
+
*/
|
|
79
|
+
export declare function codeAt(str: string, index?: number): number;
|
|
80
|
+
/**
|
|
81
|
+
* 大写格式
|
|
82
|
+
*/
|
|
83
|
+
export declare function upper(str: string): string;
|
|
84
|
+
/**
|
|
85
|
+
* 小写格式
|
|
86
|
+
*/
|
|
87
|
+
export declare function lower(str: string): string;
|
|
88
|
+
/**
|
|
89
|
+
* str 是否包含 part
|
|
90
|
+
*
|
|
91
|
+
* @param str
|
|
92
|
+
* @param part
|
|
93
|
+
* @return 是否包含
|
|
94
|
+
*/
|
|
95
|
+
export declare function has(str: string, part: string): boolean;
|
|
96
|
+
/**
|
|
97
|
+
* 判断长度大于 0 的字符串
|
|
98
|
+
*
|
|
99
|
+
* @param str
|
|
100
|
+
* @return
|
|
101
|
+
*/
|
|
102
|
+
export declare function falsy(str: any): boolean;
|