Download frontend/src/utility-functions/escape.ts from openfree/graphite2: direct link, hf CLI and curl.
- Browser
- Download file 350 Bytes
-
https://huggingface.co/spaces/openfree/graphite2/resolve/main/frontend/src/utility-functions/escape.ts
- Command line
-
hf download hf://spaces/openfree/graphite2/frontend/src/utility-functions/escape.ts
-
curl -L -o escape.ts https://huggingface.co/spaces/openfree/graphite2/resolve/main/frontend/src/utility-functions/escape.ts
350 Bytes
| /* eslint-disable no-useless-escape */ | |
| /* eslint-disable quotes */ | |
| export function escapeJSON(str: string): string { | |
| return str | |
| .replace(/[\\]/g, "\\\\") | |
| .replace(/[\"]/g, '\\"') | |
| .replace(/[\/]/g, "\\/") | |
| .replace(/[\b]/g, "\\b") | |
| .replace(/[\f]/g, "\\f") | |
| .replace(/[\n]/g, "\\n") | |
| .replace(/[\r]/g, "\\r") | |
| .replace(/[\t]/g, "\\t"); | |
| } | |