From d43ff0aca8dcaa22b6e6c9f2d4c97ce3d68b9d4d Mon Sep 17 00:00:00 2001 From: Alexander Cerutti Date: Wed, 13 Oct 2021 01:08:38 +0200 Subject: [PATCH] Removed isValidRGB function (as unused anymore) --- src/utils.ts | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/src/utils.ts b/src/utils.ts index 16e216f..dd65ddd 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -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 * @param date