Skip to content

validate value

Choose a tag to compare

@Srabutdotcom Srabutdotcom released this 25 May 14:22
· 6 commits to master since this release

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