Skip to content

Commit 4c2077e

Browse files
committed
Lint
1 parent d092779 commit 4c2077e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/utils/parser.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export default function parse(expression: string): Options {
1919
let to;
2020

2121
// Search for separating keyword (case insensitive) to split the expression into 2 parts
22-
if (/to|in|as/i.exec(expression)) {
22+
if (/to|in|as/i.test(expression)) {
2323
const firstPart = expression.slice(0, expression.search(/to|in|as/i)).toUpperCase().trim();
2424

2525
from = firstPart.replace(/[^A-Za-z]/g, '');
@@ -29,12 +29,12 @@ export default function parse(expression: string): Options {
2929
}
3030

3131
if (Number.isNaN(amount) || expression.trim().length === 0) {
32-
throw new TypeError('Could not parse the `amount` argument. Make sure it includes at least a valid amount.');
32+
throw new Error('Could not parse the expression. Make sure it includes at least a valid amount.');
3333
}
3434

3535
return {
3636
amount,
3737
from: from.toUpperCase() || undefined,
38-
to
38+
to,
3939
};
4040
}

0 commit comments

Comments
 (0)