cleanup
This commit is contained in:
parent
f37a986497
commit
a2d7fc4901
|
@ -66,8 +66,7 @@ const colorConverter = (() => {
|
||||||
|
|
||||||
// Mod 360 applied to h before function call
|
// Mod 360 applied to h before function call
|
||||||
function validateHSL(h, s, l) {
|
function validateHSL(h, s, l) {
|
||||||
const isPercent = v => v !== false && v >= 0 && v <= 100;
|
return h >= 0 && h <= 360 && [s, l].every(v => v !== false && v >= 0 && v <= 100);
|
||||||
return h >= 0 && h <= 360 && isPercent(s) && isPercent(l);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// % converted before function call
|
// % converted before function call
|
||||||
|
@ -145,7 +144,6 @@ const colorConverter = (() => {
|
||||||
const h = parseHue(first);
|
const h = parseHue(first);
|
||||||
const s = parsePercentage(num[1]);
|
const s = parsePercentage(num[1]);
|
||||||
const l = parsePercentage(num[2]);
|
const l = parsePercentage(num[2]);
|
||||||
console.log(h, s, l, first, num);
|
|
||||||
return validateHSL(h, s, l) ? {type: 'hsl', h, s, l, a} : null;
|
return validateHSL(h, s, l) ? {type: 'hsl', h, s, l, a} : null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user