From 5435d53fe005ceedae87d9f518a242c38ee4dc17 Mon Sep 17 00:00:00 2001 From: Melih Birim Date: Sun, 28 Dec 2025 01:10:32 +0300 Subject: [PATCH 1/2] refactor: add missing JSDoc comments for isRgbColor and isHashtag Added comprehensive JSDoc documentation for two functions that were missing it: - isRgbColor(): Documents RGB/RGBA color validation with format examples - isHashtag(): Documents hashtag validation including the preferHashtagOver3CharHex option for disambiguating from 3-char hex colors Improves code documentation and developer experience when using these functions. --- index.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/index.js b/index.js index 23936b1..c05028b 100644 --- a/index.js +++ b/index.js @@ -719,6 +719,13 @@ function isMACAddress(value) { function isHexColor(value) { return PATTERNS.HEX_COLOR.test(value); } + +/** + * Checks if a given value is a valid RGB or RGBA color + * Supports formats like rgb(255, 0, 0) and rgba(0, 255, 0, 0.5) + * @param {string} value - The value to check + * @returns {boolean} True if the value is a valid RGB/RGBA color, false otherwise + */ function isRgbColor(value) { return PATTERNS.RGB_COLOR.test(value); } @@ -750,6 +757,14 @@ function isISBN(value) { return PATTERNS.ISBN.test(value); } +/** + * Checks if a given value is a valid hashtag (e.g., #hello, #OpenSource) + * Handles disambiguation from 3-character hex colors when option is enabled + * @param {string} value - The value to check + * @param {Object} [options={}] - Options object + * @param {boolean} [options.preferHashtagOver3CharHex=false] - If true, prefer hashtag interpretation for 4-char strings starting with # + * @returns {boolean} True if the value is a valid hashtag, false otherwise + */ function isHashtag(value, options = {}) { if (!value.startsWith('#')) return false; From c9e491e8a4e6ca1e47ee7683edd4e911cca72f5a Mon Sep 17 00:00:00 2001 From: Melih Birim Date: Sun, 28 Dec 2025 01:12:15 +0300 Subject: [PATCH 2/2] refactor: add missing JSDoc comment for isRgbColor function --- index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/index.js b/index.js index c05028b..8aa2265 100644 --- a/index.js +++ b/index.js @@ -729,6 +729,7 @@ function isHexColor(value) { function isRgbColor(value) { return PATTERNS.RGB_COLOR.test(value); } + /** * Checks if a given value is a percentage * @param {string} value - The value to check