* Replaces the symbols and patterns in a credit card schema including Luhn checksum. * * This method supports both range patterns `[4-9]` as well as the patterns used by `replaceSymbolWithNumber()`. * `L` will be replaced with the appropriate Luhn checksum. * * @param string The credi
(
string: string = '6453-####-####-####-###L',
symbol: string = '#'
)
| 371 | * @since 5.0.0 |
| 372 | */ |
| 373 | replaceCreditCardSymbols( |
| 374 | string: string = '6453-####-####-####-###L', |
| 375 | symbol: string = '#' |
| 376 | ): string { |
| 377 | // default values required for calling method without arguments |
| 378 | |
| 379 | string = legacyRegexpStringParse(this.faker, string); // replace [4-9] with a random number in range etc... |
| 380 | string = legacyReplaceSymbolWithNumber(this.faker, string, symbol); // replace ### with random numbers |
| 381 | |
| 382 | const checkNum = luhnCheckValue(string); |
| 383 | return string.replace('L', String(checkNum)); |
| 384 | } |
| 385 | |
| 386 | /** |
| 387 | * Generates a string matching the given regex like expressions. |
no test coverage detected