traceperf
Version:
High-performance function execution tracking and monitoring for Node.js
30 lines (29 loc) • 962 B
TypeScript
/**
* String utility functions
*/
/**
* Center a string with padding
*
* @param str - The string to center
* @param length - The total length of the returned string
* @param char - The character to use for padding (default: space)
* @returns The padded string
*/
export declare function padCenter(str: string, length: number, char?: string): string;
/**
* Truncate a string to a specified length and add ellipsis if needed
*
* @param str - The string to truncate
* @param maxLength - The maximum length allowed
* @returns The truncated string
*/
export declare function truncate(str: string, maxLength: number): string;
/**
* Ensure that the string is at least a certain length
*
* @param str - The string to pad
* @param length - The minimum length desired
* @param char - The character to use for padding (default: space)
* @returns The padded string
*/
export declare function padEnd(str: string, length: number, char?: string): string;