Spaces:
Runtime error
Runtime error
Download static/node_modules/mongoose/lib/helpers/schema/idGetter.js from kaab4321/NarrativeFlow: direct link, hf CLI and curl.
- Browser
- Download file 590 Bytes
-
https://huggingface.co/spaces/kaab4321/NarrativeFlow/resolve/main/static/node_modules/mongoose/lib/helpers/schema/idGetter.js
- Command line
-
hf download hf://spaces/kaab4321/NarrativeFlow/static/node_modules/mongoose/lib/helpers/schema/idGetter.js
-
curl -L -o idGetter.js https://huggingface.co/spaces/kaab4321/NarrativeFlow/resolve/main/static/node_modules/mongoose/lib/helpers/schema/idGetter.js
590 Bytes
| ; | |
| /*! | |
| * ignore | |
| */ | |
| module.exports = function addIdGetter(schema) { | |
| // ensure the documents receive an id getter unless disabled | |
| const autoIdGetter = !schema.paths['id'] && | |
| schema.paths['_id'] && | |
| schema.options.id; | |
| if (!autoIdGetter) { | |
| return schema; | |
| } | |
| if (schema.aliases && schema.aliases.id) { | |
| return schema; | |
| } | |
| schema.virtual('id').get(idGetter); | |
| return schema; | |
| }; | |
| /** | |
| * Returns this documents _id cast to a string. | |
| * @api private | |
| */ | |
| function idGetter() { | |
| if (this._id != null) { | |
| return this._id.toString(); | |
| } | |
| return null; | |
| } | |