Download react-spring/packages/shared/src/regexs.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 932 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-spring/packages/shared/src/regexs.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset@1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-spring/packages/shared/src/regexs.ts
-
curl -L -o regexs.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-spring/packages/shared/src/regexs.ts
932 Bytes
| // Problem: https://github.com/animatedjs/animated/pull/102 | |
| // Solution: https://stackoverflow.com/questions/638565/parsing-scientific-notation-sensibly/658662 | |
| export const numberRegex = /[+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?/g | |
| // Covers rgb, rgba, hsl, hsla | |
| // Taken from https://gist.github.com/olmokramer/82ccce673f86db7cda5e | |
| export const colorRegex = | |
| /(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))/gi | |
| // Gets numbers with units when specified | |
| export const unitRegex = new RegExp(`(${numberRegex.source})(%|[a-z]+)`, 'i') | |
| // get values of rgba string | |
| export const rgbaRegex = | |
| /rgba\(([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+)\)/gi | |
| /** | |
| * Parse special CSS variable format into a CSS token and a fallback. | |
| * | |
| * ``` | |
| * `var(--foo, #fff)` => [`--foo`, '#fff'] | |
| * ``` | |
| * | |
| */ | |
| export const cssVariableRegex = | |
| /var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/ | |