You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import{validate,setLocales,register,en,pt,DEFINED_RULES}from"robust-validator";constisObjectRule=(value)=>{returnvalue!==null&&typeofvalue==='object'&&!Array.isArray(value);};if(!('object'inDEFINED_RULES)){register(// https://validator.axe-api.com/customization.html'object',// The rule nameisObjectRule,// The rule functions// Translations{en: "The field must be an object",},);}
The text was updated successfully, but these errors were encountered:
But what do you think to provide a function that tells you if a rule is defined or not? An example;
import{register,isRegistered}from"robust-validator";constisObjectRule=(value)=>{returnvalue!==null&&typeofvalue==="object"&&!Array.isArray(value);};if(!isRegistered("object")){register("object",isObjectRule,{en: "The field must be an object",});}
Also, I liked the object rule you defined. I think it would be a good idea to add that rule internally. What do you think? ☺️
I suggest to add
DEFINED_RULES
use on docs.This is an example:
The text was updated successfully, but these errors were encountered: