Spaces:
Runtime error
Runtime error
Download static/node_modules/mongoose/lib/helpers/populate/lookupLocalFields.js from kaab4321/NarrativeFlow: direct link, hf CLI and curl.
- Browser
- Download file 720 Bytes
-
https://huggingface.co/spaces/kaab4321/NarrativeFlow/resolve/main/static/node_modules/mongoose/lib/helpers/populate/lookupLocalFields.js
- Command line
-
hf download hf://spaces/kaab4321/NarrativeFlow/static/node_modules/mongoose/lib/helpers/populate/lookupLocalFields.js
-
curl -L -o lookupLocalFields.js https://huggingface.co/spaces/kaab4321/NarrativeFlow/resolve/main/static/node_modules/mongoose/lib/helpers/populate/lookupLocalFields.js
720 Bytes
| ; | |
| module.exports = function lookupLocalFields(cur, path, val) { | |
| if (cur == null) { | |
| return cur; | |
| } | |
| if (cur._doc != null) { | |
| cur = cur._doc; | |
| } | |
| if (arguments.length >= 3) { | |
| if (typeof cur !== 'object') { | |
| return void 0; | |
| } | |
| if (val === void 0) { | |
| return void 0; | |
| } | |
| if (cur instanceof Map) { | |
| cur.set(path, val); | |
| } else { | |
| cur[path] = val; | |
| } | |
| return val; | |
| } | |
| // Support populating paths under maps using `map.$*.subpath` | |
| if (path === '$*') { | |
| return cur instanceof Map ? | |
| Array.from(cur.values()) : | |
| Object.keys(cur).map(key => cur[key]); | |
| } | |
| if (cur instanceof Map) { | |
| return cur.get(path); | |
| } | |
| return cur[path]; | |
| }; | |