Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
Download utils/index.ts from enzostvs/hub-api-playground: direct link, hf CLI and curl.
- Browser
- Download file 409 Bytes
-
https://huggingface.co/spaces/enzostvs/hub-api-playground/resolve/main/utils/index.ts
- Command line
-
hf download hf://spaces/enzostvs/hub-api-playground/utils/index.ts
-
curl -L -o index.ts https://huggingface.co/spaces/enzostvs/hub-api-playground/resolve/main/utils/index.ts
409 Bytes
| export const splitStringBracket = (str: string): any[] => { | |
| // Split string by bracket but keep the bracket | |
| const result = str.split(/(\{.*?\})/g) | |
| return result.map((item) => { | |
| if (item.startsWith('{') && item.endsWith('}')) { | |
| return { | |
| editable: true, | |
| content: item.slice(1, -1), | |
| key: item, | |
| } | |
| } return { | |
| editable: false, | |
| content: item | |
| } | |
| }) | |
| } |