unnestcss
Version:
A library for un-nesting CSS
1 lines • 1.53 kB
Source Map (JSON)
{"version":3,"file":"utility.cjs","sources":["../../../src/lib/stylis/utility.ts"],"sourcesContent":["import { NULL_CHARACTER } from \"./enum.ts\";\n\nexport const charCodeAt = (value: string, index = 0): number => value.charCodeAt(index) | 0;\n\nexport const charCodeFrom: (...codes: number[]) => string = String.fromCharCode;\n\nexport const charOr = (value: string, fallback: string): string =>\n value === NULL_CHARACTER ? fallback : value;\n\nexport const hash = (value: string, length: number): number => {\n if (charCodeAt(value, 0) ^ 45) {\n let hashValue = length << 2;\n hashValue ^= charCodeAt(value, 0);\n hashValue <<= 2;\n hashValue ^= charCodeAt(value, 1);\n hashValue <<= 2;\n hashValue ^= charCodeAt(value, 2);\n hashValue <<= 2;\n hashValue ^= charCodeAt(value, 3);\n return hashValue;\n }\n return 0;\n};\n\nconst hexRe = /^[[\\da-fA-F]$/;\n\nexport const isHexChar = (value: string): boolean => hexRe.test(value);\n"],"names":["charCodeAt","value","index","charCodeFrom: (...codes: number[]) => string","charOr","NULL_CHARACTER","fallback","hash","hashValue","length","hexRe","isHexChar"],"mappings":"+CAEaA,GAAc,EAAe,EAAQ,IAAcC,EAAM,WAAWC,GAAS,EAE7EC,EAA+C,OAAO,aAEtDC,GAAU,EAAe,IACpCH,IAAUI,EAAAA,eAAiBC,EAAWL,EAE3BM,GAAQ,EAAe,IAA2B,CAC7D,GAAIP,EAAWC,EAAO,GAAK,GAAI,CAC7B,IAAIO,EAAYC,GAAU,EAQ1B,MAPA,IAAaT,EAAWC,EAAO,GAC/B,IAAc,EACd,GAAaD,EAAWC,EAAO,GAC/B,IAAc,EACd,GAAaD,EAAWC,EAAO,GAC/B,IAAc,EACd,GAAaD,EAAWC,EAAO,GACxBO,EAET,MAAO,IAGHE,EAAQ,gBAEDC,EAAa,GAA2BD,EAAM,KAAKT"}