Spaces:
Sleeping
Sleeping
Download src/utils/inputSanitizer.js from Huzaifa1435/Carpool_final: direct link, hf CLI and curl.
- Browser
- Download file 509 Bytes
-
https://huggingface.co/spaces/Huzaifa1435/Carpool_final/resolve/main/src/utils/inputSanitizer.js
- Command line
-
hf download hf://spaces/Huzaifa1435/Carpool_final/src/utils/inputSanitizer.js
-
curl -L -o inputSanitizer.js https://huggingface.co/spaces/Huzaifa1435/Carpool_final/resolve/main/src/utils/inputSanitizer.js
509 Bytes
| function trimString(value) { | |
| if (value == null) return ''; | |
| return String(value).trim(); | |
| } | |
| function sanitizeString(value, maxLen) { | |
| const s = trimString(value); | |
| if (maxLen && s.length > maxLen) return s.slice(0, maxLen); | |
| return s; | |
| } | |
| function exceedsMaxLength(value, maxLen) { | |
| if (value == null) return false; | |
| return String(value).length > maxLen; | |
| } | |
| module.exports = { | |
| trimString, | |
| sanitizeString, | |
| exceedsMaxLength, | |
| MAX_CUSTOMER_MESSAGE: 500, | |
| MAX_LOCATION: 200, | |
| MAX_REVIEW: 1000, | |
| }; | |