JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/validate.js/0.9.0/validate.js"></script>
JavaScript
var a = ['', ' ', ' '];
a.forEach(function (v) {
console.log('value |%s|', v);
// Presence on
console.log('presesence on' , validate.single(v, {
presence: true,
format: {
pattern: "^.{1,64}$",
message: 'haha',
},
}));
// presence off
console.log('presence off', validate.single(v, {
presence: false,
format: {
pattern: "^.{1,64}$",
message: 'haha',
},
}));
});