Validates input data on sendy frontend apps
Validates input data on sendy frontend apps
``js`
npm i @sendyit/validation
`js`
import validator from '@sendyit/validation';
`js`
validator('image', 'https://sendy-partner-docs.s3-eu-west-1.amazonaws.com/photo/photo_name.png', 'ke', '.login__forgotPass')
The validator returns a true or false boolean so you can assign it to a variable as follows
`js`
const IsValid = validator('image', 'https://sendy-partner-docs.s3-eu-west-1.amazonaws.com/photo/photo_name.png', 'ke', '.login__forgotPass')
The parameters are passed as follows
* Field type - email, image, name, phone, MBUNumberPlate, EBUNumberPlate, FBUNumberPlate, LogBook, TaxPinRegistrationPeer, TaxPinRegistrationBiz, DrivingLicense, InsurancePolicy, InsuranceCertificate, NationalId, CompanyRegistration, TransporterCertificate, ConsularCardke, ug, ci
* Field value
* Country code - .input-id or #input-class` (Optional)*
input identifier -
(This allows the validator to create a green/red halo around the input based on whether the validation has passed or failed)
NOTE: The validator does not track/listen in on the input. To get validation on typing or keypress please call the function inside a watcher and pass the value into it