Download chakra-ui/packages/react/src/utils/unit.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 402 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/f5071caa249115f3b590492f1c8eb471e02aae4b/chakra-ui/packages/react/src/utils/unit.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset@f5071caa249115f3b590492f1c8eb471e02aae4b/chakra-ui/packages/react/src/utils/unit.ts
-
curl -L -o unit.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/f5071caa249115f3b590492f1c8eb471e02aae4b/chakra-ui/packages/react/src/utils/unit.ts
402 Bytes
| const lengthUnits = | |
| "cm,mm,Q,in,pc,pt,px,em,ex,ch,rem,lh,rlh,vw,vh,vmin,vmax,vb,vi,svw,svh,lvw,lvh,dvw,dvh,cqw,cqh,cqi,cqb,cqmin,cqmax,%" | |
| const lengthUnitsPattern = `(?:${lengthUnits.split(",").join("|")})` | |
| const lengthRegExp = new RegExp( | |
| `^[+-]?[0-9]*.?[0-9]+(?:[eE][+-]?[0-9]+)?${lengthUnitsPattern}$`, | |
| ) | |
| export const isCssUnit = (v: unknown) => | |
| typeof v === "string" && lengthRegExp.test(v) | |