Closed dedicio closed 3 years ago
Want to request a feature or report a bug?
Report a bug
What is the current behavior?
When it sends param creditCardNumber = null in isSecurityCodeValid methods, it generates a console error
creditCardNumber = null
isSecurityCodeValid
The problem is: try to replace from a null value on line 33: const numberOnly = number.replace(/[^\d]/g, '');
null
const numberOnly = number.replace(/[^\d]/g, '');
Suggestion:
export const isSecurityCodeValid = (creditCardNumber, securityCode) => { if (!creditCardNumber || !securityCode) return false; const numberLength = getCreditCardCodeLengthByNumber(creditCardNumber); return new RegExp(`^[0-9]{${numberLength}}$`).test(securityCode); };
What is the expected behavior?
The method isSecurityCodeValid returns false when send any null param
false
Want to request a feature or report a bug?
Report a bug
What is the current behavior?
When it sends param
creditCardNumber = null
inisSecurityCodeValid
methods, it generates a console errorThe problem is: try to replace from a
null
value on line 33:const numberOnly = number.replace(/[^\d]/g, '');
Suggestion:
What is the expected behavior?
The method
isSecurityCodeValid
returnsfalse
when send anynull
param