Skip to content

Commit

Permalink
do not use named capture groups
Browse files Browse the repository at this point in the history
  • Loading branch information
xxczaki committed Mar 10, 2020
1 parent 0396961 commit eeef58c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/utils/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ export default function parse(expression: string): Options {
if (/to|in|as/i.exec(expression)) {
const firstPart = expression.slice(0, expression.search(/to|in|as/i)).toUpperCase().trim();

from = firstPart.replace(/(?<currency_code>[^A-Za-z])/g, '');
from = firstPart.replace(/[^A-Za-z]/g, '');
to = expression.slice(expression.search(/to|in|as/i) + 2).toUpperCase().trim();
} else {
from = expression.replace(/(?<currency_code>[^A-Za-z])/g, '');
from = expression.replace(/[^A-Za-z]/g, '');
}

if (amount === undefined) {
Expand Down

0 comments on commit eeef58c

Please sign in to comment.