Spaces:
Sleeping
Sleeping
Download src/lib/utils.js from TXAVLOG/dptxa-proxy: direct link, hf CLI and curl.
- Browser
- Download file 459 Bytes
-
https://huggingface.co/spaces/TXAVLOG/dptxa-proxy/resolve/main/src/lib/utils.js
- Command line
-
hf download hf://spaces/TXAVLOG/dptxa-proxy/src/lib/utils.js
-
curl -L -o utils.js https://huggingface.co/spaces/TXAVLOG/dptxa-proxy/resolve/main/src/lib/utils.js
459 Bytes
| export function slugify(text) { | |
| return text | |
| .toString() | |
| .normalize('NFD') | |
| .replace(/[\u0300-\u036f]/g, '') | |
| .toLowerCase() | |
| .replace(/[^a-z0-9]+/g, '-') | |
| .replace(/(^-|-$)+/g, ''); | |
| } | |
| export function formatYear(dateStr) { | |
| if (!dateStr) return ''; | |
| const d = new Date(dateStr); | |
| return isNaN(d) ? '' : d.getFullYear().toString(); | |
| } | |
| export function truncate(str, n) { | |
| return str?.length > n ? str.substr(0, n - 1) + '...' : str; | |
| } | |