Spaces:
Runtime error
Runtime error
Download static/node_modules/mongoose/lib/helpers/query/handleImmutable.js from kaab4321/NarrativeFlow: direct link, hf CLI and curl.
- Browser
- Download file 661 Bytes
-
https://huggingface.co/spaces/kaab4321/NarrativeFlow/resolve/main/static/node_modules/mongoose/lib/helpers/query/handleImmutable.js
- Command line
-
hf download hf://spaces/kaab4321/NarrativeFlow/static/node_modules/mongoose/lib/helpers/query/handleImmutable.js
-
curl -L -o handleImmutable.js https://huggingface.co/spaces/kaab4321/NarrativeFlow/resolve/main/static/node_modules/mongoose/lib/helpers/query/handleImmutable.js
661 Bytes
| ; | |
| const StrictModeError = require('../../error/strict'); | |
| module.exports = function handleImmutable(schematype, strict, obj, key, fullPath, ctx) { | |
| if (schematype == null || !schematype.options || !schematype.options.immutable) { | |
| return false; | |
| } | |
| let immutable = schematype.options.immutable; | |
| if (typeof immutable === 'function') { | |
| immutable = immutable.call(ctx, ctx); | |
| } | |
| if (!immutable) { | |
| return false; | |
| } | |
| if (strict === false) { | |
| return false; | |
| } | |
| if (strict === 'throw') { | |
| throw new StrictModeError(null, | |
| `Field ${fullPath} is immutable and strict = 'throw'`); | |
| } | |
| delete obj[key]; | |
| return true; | |
| }; | |