volder is powerful Object schema validation lets you describe your data using a simple and readable schema and transform a value to match the requirements
pattern config that accept a function that validate any type and return boolean value; any type throw an error
transform config that accept a function that transform and change the value of that data and return it; use it in the end of validation
volder types should be a function that validate the data and return boolean
// all of this validate a string type
1 - Email => email value
2 - UUID => uuid value
3 - CreditCard => creditcard valuee
4 - Domain => domain value
5 - URI => uri value
6 - IPAddress => ipaddress value
7 - base64 => base64 value
1 - arrayOf(array of types) => array must contain in what you define
2 - unique(boolean) => should array to be unique or not
2 compat(function) => Removes falsey values from the array. Providing a rejecter function lets you specify the rejection criteria yourself.
1 - alphanum(boolean) => requires to be the value cotains only [a-z] [A-Z] [0-9]
2 - convertCase(string) => 'lower' or 'upper'
3 - lowerecase(boolean) => should be in lowercase otherwise error
[] uppoerecase (boolean)=> should be in uppercase otherwise error
5 - matches (regex pattern)=> regex
1 - switch(boolean) => convert the truthy to true
2 - sensible(boolean) => convert the truthy or falsy value to real boolean valueallow the unreal boolean value the advantage of the state
3 - state (boolean) => to check if the value is truthy or falsy
///////// mybe improve the boolean type
1 - integer(boolean) => number should be an integer not float
2 - float(boolean) => number should be an float not integer
3 - round(boolean) => round the number to closest integer
4 - fixed(number) => fixed number of decimal value in a number
5 - precision(number) => specifies the maximum number of decimal places
6 - sign('nigative' | 'positive' ) => specifies the sign in the number should be
sometimes we want to strict key property in input,
by that we remove the unused key validation issue
and you can fix TypeError: Expected a number but received a undefined at maxLength property
when using min or max config in array or string
1 - with(array of strings) => define the keys that required exist in object
2 - without(array of strings) => reversing the top config
3 - instance(constructor) => value should be an instance of that constructor