isValidHex.cjs 433 B

1234567891011121314151617
  1. // NOTICE: This file is generated by Rollup. To modify it,
  2. // please instead edit the ESM counterpart and rebuild with Rollup (npm run build).
  3. 'use strict';
  4. const IS_VALID_HEX = /^#(?:[\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;
  5. /**
  6. * Check if a value is a valid 3, 4, 6 or 8 digit hex
  7. *
  8. * @param {string} value
  9. * @returns {boolean}
  10. */
  11. function isValidHex(value) {
  12. return IS_VALID_HEX.test(value);
  13. }
  14. module.exports = isValidHex;