Fix: validate function should return a boolean
This commit is contained in:
parent
fc53234dba
commit
6beed6b9c9
|
@ -44,9 +44,7 @@ const colorConverter = (() => {
|
||||||
|
|
||||||
// Copied from _hexcolor() in parserlib.js
|
// Copied from _hexcolor() in parserlib.js
|
||||||
function validateHex(color) {
|
function validateHex(color) {
|
||||||
return (!/^#[a-f\d]+$/i.test(color) || [4, 5, 7, 9].every(n => color.length !== n))
|
return /^#[a-f\d]+$/i.test(color) && [4, 5, 7, 9].some(n => color.length === n));
|
||||||
? false
|
|
||||||
: color;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// % converted before function call
|
// % converted before function call
|
||||||
|
|
Loading…
Reference in New Issue
Block a user