Removed isValidRGB function (as unused anymore)

This commit is contained in:
Alexander Cerutti
2021-10-13 01:08:38 +02:00
parent a9f5f22389
commit d43ff0aca8

View File

@@ -1,26 +1,3 @@
/**
* Checks if an rgb value is compliant with CSS-like syntax
*
* @params value - string to analyze
* @returns true if valid rgb, false otherwise
*/
export function isValidRGB(value?: string): boolean {
if (!value || typeof value !== "string") {
return false;
}
const rgb = value.match(
/^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)/,
);
if (!rgb) {
return false;
}
return rgb.slice(1, 4).every((v) => Math.abs(Number(v)) <= 255);
}
/** /**
* Acts as a wrapper for converting date to W3C string * Acts as a wrapper for converting date to W3C string
* @param date * @param date