Repository navigation
Releases: Srabutdotcom/validate
Release list
validate value
validate a value in javascript using 1 mandatory argument and 2 optional arguments.
v1.0.3
Validate value based on types and/ or instance and / or values.
for example if i want to validate variable named "myvalue" with types = ["number"] and values = [20, 33]
just call
const isValid = validate(myvalue, ["number"], [20, 33])
// isValid will return either "true" if it is 20 or 30 otherwise will return "TypeError"argument 1 and 2 is optional, if you don't provide it myvalue will be any types and any values
validate value
Validate value based on types and/ or instance and / or values.
for example if i want to validate variable named "myvalue" with types = ["number"] and values = [20, 33]
just call
const isValid = validate(myvalue, ["number"], [20, 33])
// isValid will return either "true" or "TypeError"argument 1 and 2 is optional, if you don't provide it myvalue will be any types and any values
validate value
Validate value based on types and/ or instance and / or values.
for example if i want to validate variable named "myvalue" with types = ["number"] and values = [20, 33]
just call
const isValid = validate(myvalue, ["number"], [20, 33])
// isValid will return either "true" or "TypeError"argument 1 and 2 is optional, if you don't provide it myvalue will be any types and any values
validate value
Validate value based on types and/ or instance and / or values.
for example if i want to validate variable named "myvalue" with types = ["number"] and values = [20, 33]
just call
const isValid = validate(myvalue, ["number"], [20, 33])
// isValid will return either "true" or "TypeError"argument 1 and 2 is optional, if you don't provide it myvalue will be any types and any values