File tree 1 file changed +3
-3
lines changed
1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ export default function parse(expression: string): Options {
19
19
let to ;
20
20
21
21
// Search for separating keyword (case insensitive) to split the expression into 2 parts
22
- if ( / t o | i n | a s / i. exec ( expression ) ) {
22
+ if ( / t o | i n | a s / i. test ( expression ) ) {
23
23
const firstPart = expression . slice ( 0 , expression . search ( / t o | i n | a s / i) ) . toUpperCase ( ) . trim ( ) ;
24
24
25
25
from = firstPart . replace ( / [ ^ A - Z a - z ] / g, '' ) ;
@@ -29,12 +29,12 @@ export default function parse(expression: string): Options {
29
29
}
30
30
31
31
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.' ) ;
33
33
}
34
34
35
35
return {
36
36
amount,
37
37
from : from . toUpperCase ( ) || undefined ,
38
- to
38
+ to,
39
39
} ;
40
40
}
You can’t perform that action at this time.
0 commit comments