python-archieve-projects/WechatBot/node_modules/cmd-ts/dist/esm/utils.d.ts

43 lines
987 B
TypeScript

/**
* @ignore
*/
export declare function padNoAnsi(str: string, length: number, place: 'end' | 'start'): string;
/**
* Group an array by a function that returns the key
*
* @ignore
*/
export declare function groupBy<A, B extends string>(objs: A[], f: (a: A) => B): Record<B, A[]>;
/**
* A better typed version of `Object.entries`
*
* @ignore
*/
export declare function entries<Obj extends Record<string, any>>(obj: Obj): {
[key in keyof Obj]: [key, Obj[key]];
}[keyof Obj][];
/**
* Enumerate over a list, to get a pair of [index, value]
*
* @ignore
*/
export declare function enumerate<T>(arr: T[]): Generator<[number, T]>;
/**
* Array#flatMap polyfill
*
* @ignore
*/
export declare function flatMap<A, B>(xs: A[], fn: (a: A) => B[]): B[];
/**
* Flatten an array
*
* @ignore
*/
export declare function flatten<A>(xs: A[][]): A[];
/**
* Either the provided `T` or an empty object
*/
export declare type AllOrNothing<T> = T | {
[key in keyof T]?: never;
};