t-comm
Version:
专业、稳定、纯粹的工具库
47 lines (46 loc) • 1.6 kB
TypeScript
export declare function isChina(region: string): boolean;
export declare function fixedNumber(num: number): number;
export declare function formatValue(value: number | string): string | number;
export declare function genTableData(data: Array<any>): Record<string, any>[];
export declare function sortObj(obj: Record<string, any>, sortKeyList: Array<string>): Record<string, any>;
export declare function clusterChina(obj: Record<string, any>): void;
/**
* 解析 RUM 性能数据返回值,按地区聚合并按请求量排序
* @param results 原始接口返回数据
* @returns 按地区聚合后的数据列表
* @example
* ```ts
* const data = parseResult(rumApiResults);
* // [
* // {
* // region: '巴西',
* // allCount: 100,
* // firstScreen: 1000,
* // // ...
* // },
* // { region: '中国', allCount: 5000, ... },
* // ]
* ```
*/
export declare function parseResult(results: Array<{
[k: string]: any;
}>): Record<string, any>[];
export declare function genRUMnPerfData({ secretId, secretKey, id, startTime, endTime, type, }: {
secretId: string;
secretKey: string;
id: string | number;
startTime: number;
endTime: number;
type?: string;
}): Promise<Record<string, any>[]>;
export declare function genRUMPerfImgAndSend({ secretId, secretKey, id, startTime, endTime, type, title, chatId, webhookUrl, }: {
secretId: string;
secretKey: string;
id: string | number;
startTime: number;
endTime: number;
type?: string;
title?: string;
chatId: string;
webhookUrl: string;
}): Promise<void>;