Skip to content

Commit

Permalink
Merge pull request #1 from rodriguestiago0/convert_multiple_spaces_in…
Browse files Browse the repository at this point in the history
…to_one

Convert multiple spaces into one
  • Loading branch information
rodriguestiago0 authored Jul 12, 2024
2 parents f4ecfca + 5b7d847 commit f18e9d0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ This is a project that contains two tasks. You can trigger them manually or setu

**Output**: `Continente Porto`

This task will also remove extra space in the payee name.
**Input**: `Continente Porto`

**Output**: `Continente Porto`

### Create a transaction that deducts your payment mortgage
To configure the correct interest rate is the % multiple by 1000

Expand Down
9 changes: 7 additions & 2 deletions engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,13 @@ async function fixPayees() {
payees = await getPayees(actual, appConfig.PAYEE_REGEX_MATCH)
updatedPayee = {}
payees.forEach(payee => {
let name = payee.name.replace(new RegExp(appConfig.PAYEE_REGEX_MATCH, "gis"), "");
if (name != payee.name )
let name = payee.name;
if (appConfig.PAYEE_REGEX_MATCH != "")
{
name = payee.name.replace(new RegExp(appConfig.PAYEE_REGEX_MATCH, "gis"), "");
}
name = name.replace(new RegExp(" {2,}", "gis"), " ")
if (name != payee.name)
{
updatedPayee[payee.id] = name.trim();
console.log ("Update payee from " + payee.name + " to " + name.trim() )
Expand Down

0 comments on commit f18e9d0

Please sign in to comment.