Skip to content

Commit

Permalink
Add const for space
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhenjaHorbach committed Nov 2, 2023
1 parent fc2d0ea commit ae4c7cb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1311,6 +1311,7 @@ const CONST = {

TAX_ID: /^\d{9}$/,
NON_NUMERIC: /\D/g,
ANY_SPACE: /\s/g,

// Extract attachment's source from the data's html string
ATTACHMENT_DATA: /(data-expensify-source|data-name)="([^"]+)"/g,
Expand Down
4 changes: 2 additions & 2 deletions src/pages/iou/IOUCurrencySelection.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,10 @@ function IOUCurrencySelection(props) {
};
});

const searchRegex = new RegExp(Str.escapeForRegExp(searchValue.trim().replace(/\s/g, ' ')), 'i');
const searchRegex = new RegExp(Str.escapeForRegExp(searchValue.trim().replace(CONST.REGEX.ANY_SPACE, ' ')), 'i');
const filteredCurrencies = _.filter(
currencyOptions,
(currencyOption) => searchRegex.test(currencyOption.text.replace(/\s/g, ' ')) || searchRegex.test(currencyOption.currencyName.replace(/\s/g, ' ')),
(currencyOption) => searchRegex.test(currencyOption.text.replace(CONST.REGEX.ANY_SPACE, ' ')) || searchRegex.test(currencyOption.currencyName.replace(CONST.REGEX.ANY_SPACE, ' ')),
);
const isEmpty = searchValue.trim() && !filteredCurrencies.length;

Expand Down

0 comments on commit ae4c7cb

Please sign in to comment.