#️⃣ isValidHexColor
Verify if the function input is a valid hex color
import { isValidHexColor } from 'the-simplifier'
let verifyHex = () => {
let color = '#foo'
if(!isValidHexColor(color)) {
return console.log('Invalid hex provided')
} else {
return console.log('Valid hex provided')
}
}
verifyHex() // Expected: Invalid hex provided
The color provided must be a string and started with "#"
Last updated
Was this helpful?