Spaces:
Sleeping
Sleeping
Download utils/normalize.js from egardner/question-explorer-api: direct link, hf CLI and curl.
- Browser
- Download file 347 Bytes
-
https://huggingface.co/spaces/egardner/question-explorer-api/resolve/main/utils/normalize.js
- Command line
-
hf download hf://spaces/egardner/question-explorer-api/utils/normalize.js
-
curl -L -o normalize.js https://huggingface.co/spaces/egardner/question-explorer-api/resolve/main/utils/normalize.js
347 Bytes
| /** | |
| * Normalize a Wikipedia article title for use as a cache key/filename | |
| * | |
| * @param {string} title - Wikipedia article title | |
| * @returns {string} - Normalized title safe for filenames | |
| */ | |
| export function normalizeTitle( title ) { | |
| return title | |
| .toLowerCase() | |
| .replace( / /g, '-' ) | |
| .replace( /[^a-z0-9-]/g, '' ) | |
| .substring( 0, 100 ); | |
| } | |