File tree Expand file tree Collapse file tree 2 files changed +5
-0
lines changed Expand file tree Collapse file tree 2 files changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -110,6 +110,10 @@ function parseHeuristic(value) {
110110 * @param {object } options Locale Options
111111 */
112112export function parseAmount ( value , options ) {
113+ const containsNumbers = value . match ( / \d / g) ;
114+ if ( ! containsNumbers ) {
115+ return undefined ;
116+ }
113117 const matchedInput = value . match ( / [ 0 - 9 , . \- ] / g) ;
114118 if ( ! matchedInput ) {
115119 return undefined ;
Original file line number Diff line number Diff line change @@ -139,6 +139,7 @@ describe('parseAmount()', () => {
139139 it ( 'ignores non-number characters and returns undefined' , ( ) => {
140140 expect ( parseAmount ( 'A' ) ) . to . equal ( undefined ) ;
141141 expect ( parseAmount ( 'EUR' ) ) . to . equal ( undefined ) ;
142+ expect ( parseAmount ( 'EU R' ) ) . to . equal ( undefined ) ;
142143 } ) ;
143144
144145 it ( 'returns undefined when value is empty string' , ( ) => {
You can’t perform that action at this time.
0 commit comments