UNPKG

@darkobits/mask-string

Version:
12 lines (11 loc) 458 B
/** * Provided a pattern or array of patterns, an input string, and an optional * mask character, returns a new string modified such that any tokens therein * matching one of the provided patterns is replaced by a string of mask * characters of the same length. * * @example * * mask(/foo/g, 'foo bar') // => '*** bar' */ export default function maskString(pattern: string | RegExp | Array<string | RegExp>, str: string, maskChar?: string): string;