base64 validator

Validate a base64 encoded string

Options

Using with form field
The HTML attributes are used to set the validator options via the Declarative plugin
NameHTML attributeTypeDescription
messagedata-fv-base64___messageStringThe error message
Using the ES6 module
// You might need to change the importing path
import { base64 } from '/path/to/@form-validation/cjs/validator-base64';
const result = base64().validate({
value: ...,
options: {
message: ...,
},
});
/*
result is an object of
{
valid: true or false,
message: The error message
}
*/
Using the npm package
  • Install the validator package:
$ npm install @form-validation/validator-base64
  • Use the base64 validator:
import { base64 } from '@form-validation/validator-base64';
const result = base64().validate({
value: ...,
options: {
message: ...,
},
});

Changelog

v2.0.0
  • Add the npm package