Spaces:
Runtime error
Runtime error
Download src/utils/objectId.js from yeshwanth-kr/dss-server: direct link, hf CLI and curl.
- Browser
- Download file 431 Bytes
-
https://huggingface.co/spaces/yeshwanth-kr/dss-server/resolve/main/src/utils/objectId.js
- Command line
-
hf download hf://spaces/yeshwanth-kr/dss-server/src/utils/objectId.js
-
curl -L -o objectId.js https://huggingface.co/spaces/yeshwanth-kr/dss-server/resolve/main/src/utils/objectId.js
431 Bytes
| const { Types } = require('mongoose'); | |
| function toValidObjectIdStrings(values = []) { | |
| const ids = new Set(); | |
| for (const value of values) { | |
| if (value === null || value === undefined) continue; | |
| const normalized = String(value).trim(); | |
| if (!normalized) continue; | |
| if (Types.ObjectId.isValid(normalized)) { | |
| ids.add(normalized); | |
| } | |
| } | |
| return [...ids]; | |
| } | |
| module.exports = { | |
| toValidObjectIdStrings | |
| }; | |