UNPKG

@russ-b/nestjs-common-tools

Version:
16 lines (15 loc) 734 B
/** * Masks a string, leaving only the last N characters visible * * @param value - The string to mask * @param visibleChars - Number of characters to leave visible at the end (default: 4) * @param maskChar - Character to use for masking (default: '*') * @param preservePrefix - Number of characters to preserve at the start (optional) * * @example * maskString('+37369313123', 4) // '+373*****3123' * maskString('+37369313123', 4, '*', 4) // '+373*****3123' * maskString('user@example.com', 4) // '***********.com' * maskString('1234567890', 4) // '******7890' */ export declare function maskString(value: string, visibleChars?: number, maskChar?: string, preservePrefix?: number): string;