Credit/Debit card number validation library with input formatting
npm install @shaaditech/react-cc-validator
Credit/Debit card number validator input written in react.
Demo




* Add package in project usingyarn add @shaaditech/react-cc-validator
* Import
``js`
import CardNumberValidator from '@shaaditech/react-cc-validator';
#### Usage
You can refer to /example
`js`
const YourComponent = () => (
{({ isValid, cardType, getInputProps }) => (
{ isValid && cardType }
{isValid || Card number is invalid}
)}
);
#### Types
`js
// The props that can be passed to CardNumberValidator compopent
type PropTypes = {
children: PassedProps => ReactNode,
validCardTypes: Array
format: Boolean,
};
// The props to be passed to the input element
type InputProps = {
onChange: Function,
value: String,
};
// The props passed down to the render component
type PassedProps = {
...InputProps,
isValid: Boolean,
cardType: String,
getInputProps: () => InputProps,
};
``