Skip to content

Commit

Permalink
Switch to replaceAll in isLuhnAlgo util
Browse files Browse the repository at this point in the history
  • Loading branch information
fabian-hiller committed Oct 21, 2023
1 parent a6f405c commit 236d6c1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions library/src/utils/isLuhnAlgo/isLuhnAlgo.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Non-digit regex.
*/
const NON_DIGIT_REGEX = /\D/gu;
const NON_DIGIT_REGEX = /\D/u;

/**
* Checks whether a string with numbers corresponds to the luhn algorithm.
Expand All @@ -12,7 +12,7 @@ const NON_DIGIT_REGEX = /\D/gu;
*/
export function isLuhnAlgo(input: string) {
// Remove any non-digit chars
const number = input.replace(NON_DIGIT_REGEX, '');
const number = input.replaceAll(NON_DIGIT_REGEX, '');

// Create necessary variables
let length = number.length;
Expand Down

0 comments on commit 236d6c1

Please sign in to comment.