deno.land / x / mongoose@6.7.5 / lib / helpers / query / handleImmutable.js

handleImmutable.js
نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
'use strict';
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;};
mongoose

Version Info

Tagged at
a year ago