* Use Number.isNaN to cast strings

* Avoid changing type function
This commit is contained in:
Mike Jolley 2021-11-22 12:09:00 +00:00 committed by GitHub
parent 91008a6492
commit 128ef97010
1 changed files with 2 additions and 2 deletions

View File

@ -6,7 +6,6 @@ import { speak } from '@wordpress/a11y';
import classNames from 'classnames';
import { useCallback } from '@wordpress/element';
import { DOWN, UP } from '@wordpress/keycodes';
import { isNumber } from '@woocommerce/types';
/**
* Internal dependencies
@ -84,7 +83,8 @@ const QuantitySelector = ( {
onKeyDown={ quantityInputOnKeyDown }
onChange={ ( event ) => {
let value =
! isNumber( event.target.value ) || ! event.target.value
Number.isNaN( event.target.value ) ||
! event.target.value
? 0
: parseInt( event.target.value, 10 );
if ( hasMaximum ) {