Spaces:
Sleeping
Sleeping
Download lib/parser.ts from KazukiWatanabe/FE_Dev: direct link, hf CLI and curl.
- Browser
- Download file 341 Bytes
-
https://huggingface.co/spaces/KazukiWatanabe/FE_Dev/resolve/main/lib/parser.ts
- Command line
-
hf download hf://spaces/KazukiWatanabe/FE_Dev/lib/parser.ts
-
curl -L -o parser.ts https://huggingface.co/spaces/KazukiWatanabe/FE_Dev/resolve/main/lib/parser.ts
341 Bytes
| export function parseToJSON(xmlString: string) { | |
| const attributes = xmlString.match(/(\w+)='([^']*)'/g); | |
| const jsonObject: Record<string, string> = {}; | |
| if (attributes) { | |
| attributes.forEach((attr) => { | |
| const [key, value] = attr.split('='); | |
| jsonObject[key] = value.replace(/'/g, ''); | |
| }); | |
| } | |
| return jsonObject; | |
| } | |