Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
let value = commands[action];
let rgb = null, hsv = null;
if (action == 'rgb')
{
rgb = value.split(',');
hsv = _color.rgb.hsv(rgb);
}
else if (action == 'hsv')
hsv = value.split(',');
else if (action == 'cmyk')
hsv = _color.cmyk.hsv(value.split(','));
else if (action == 'xyz')
hsv = _color.xyz.hsv(value.split(','));
else if (action == 'hex')
hsv = _color.hex.hsv(value.split(','));
if (hsv !== null)
{
delete commands[action];
commands = {
'hue': hsv[0],
'sat': Math.max(Math.min(Math.round(hsv[1]*2.54), 254), 0),
'bri': Math.max(Math.min(Math.round(hsv[2]*2.54), 254), 0),
...commands
};
}
// check for each light, if hue lab scene is activated