👌Validators
All the validators imports from pegasus-js and how to use them
📅 isDate
Verify that the inserted input value is a valid date
import { Validators } from 'pegasus-js'
const instance = new Validators()
instance.isDate('this is not a valid date') // false
instance.isDate('2022-01-01') // true
📫 isEmail
Verify that the inserted input value is a valid email
import { Validators } from 'pegasus-js'
const instance = new Validators()
instance.isEmail('this is not a valid email') // false
instance.isEmail('dev.guilhermebrasil@gmail.com') // true
🔗 isUrl
Verify that the inserted input value is a valid url
import { Validators } from 'pegasus-js'
const instance = new Validators()
instance.isUrl('this is not a valid url') // false
instance.isUrl('https://github.com/gbrasil720/pegasus-js') // true
🎨 isColorValid
Verify that the inserted input value has a valid color code
import { Validators } from 'pegasus-js'
const instance = new Validators()
// WRONG
instance.isColorValid({
colorType: 'hex',
color: '#fff'
}) // false
// RIGHT
instance.isColorValid({
colorType: 'hex',
color: '#ffffff'
}) // true
The hex color code must have 6 digits
Last updated