@aplus-frontend/utils
Version:
Utils for Aplus frontend team.
21 lines (20 loc) • 1.11 kB
TypeScript
/**
* Makes the first character of a string uppercase
*/
export declare function upperFirst(str: string): string;
export declare function wait(ms: number): Promise<unknown>;
/**
* Recursively merge two objects.
* 递归合并两个对象。
*
* @param source The source object to merge from. 要合并的源对象。
* @param target The target object to merge into. 目标对象,合并后结果存放于此。
* @param mergeArrays How to merge arrays. Default is "replace".
* 如何合并数组。默认为replace。
* - "union": Union the arrays. 对数组执行并集操作。
* - "intersection": Intersect the arrays. 对数组执行交集操作。
* - "concat": Concatenate the arrays. 连接数组。
* - "replace": Replace the source array with the target array. 用目标数组替换源数组。
* @returns The merged object. 合并后的对象。
*/
export declare function deepMerge<T extends object | null | undefined, U extends object | null | undefined>(source: T, target: U, mergeArrays?: 'union' | 'intersection' | 'concat' | 'replace'): T & U;