markugen
Version:
Markdown to HTML/PDF static site generation tool
42 lines (41 loc) • 1.38 kB
TypeScript
/**
* Replaces any hyphens in the keys with the camel case version
* @param obj the object to convert
* @returns a new object with the keys converted to camel case
*/
export declare function keysToCamelCase(obj: any): any;
/**
* Computes the parts of time from the given milliseconds
* @param ms the milliseconds to compute
* @returns the time parts
*/
export declare function timeParts(ms: number): {
days: number;
hours: number;
minutes: number;
seconds: number;
milliseconds: number;
};
export interface NumFormat {
precision?: number;
fixed?: number;
}
/**
* Formats the given milliseconds into human readable format
*/
export declare function timeFormat(ms: number, format?: NumFormat): string;
/**
* Formats the given number with precision or fixed decimals
* @param num the number to format
* @param format the formatting to use
* @returns the formatted number as a string
*/
export declare function formatNumber(num: number, format?: NumFormat): string;
/**
* Replaces the last occurrence of {@link search} in the {@link text}
* @param text the text to search
* @param search the text or regex to search for
* @param replace the text to replace the match with
* @returns the string with the last occurrence replaced
*/
export declare function replaceLast(text: string, search: string | RegExp, replace: string): string;