Download chakra-ui/packages/react/src/styled-system/esc.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 430 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/f5071caa249115f3b590492f1c8eb471e02aae4b/chakra-ui/packages/react/src/styled-system/esc.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset@f5071caa249115f3b590492f1c8eb471e02aae4b/chakra-ui/packages/react/src/styled-system/esc.ts
-
curl -L -o esc.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/f5071caa249115f3b590492f1c8eb471e02aae4b/chakra-ui/packages/react/src/styled-system/esc.ts
430 Bytes
| const rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|^-|[^\x80-\uFFFF\w-]/g | |
| const fcssescape = function (ch: string, asCodePoint: string) { | |
| if (!asCodePoint) return "\\" + ch | |
| if (ch === "\0") return "\uFFFD" | |
| if (ch === "-" && ch.length === 1) return "\\-" | |
| return ch.slice(0, -1) + "\\" + ch.charCodeAt(ch.length - 1).toString(16) + "" | |
| } | |
| export const esc = (sel: string) => { | |
| return (sel + "").replace(rcssescape, fcssescape) | |
| } | |