UNPKG

@stacksjs/ts-validation

Version:

A simple TypeScript starter kit using Bun.

11 lines (8 loc) 279 B
export default function isHSL(str: string): boolean { assertString(str) const strippedStr = str.replace(/\s+/g, ' ').replace(/\s?(hsla?\(|\)|,)\s?/gi, '$1') if (strippedStr.includes(',')) { return hslComma.test(strippedStr) } return hslSpace.test(strippedStr) };