Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

handleImmutable.js 453B

123456789101112131415161718
  1. 'use strict';
  2. const StrictModeError = require('../../error/strict');
  3. module.exports = function handleImmutable(schematype, strict, obj, key, fullPath) {
  4. if (schematype == null || !schematype.options.immutable) {
  5. return false;
  6. }
  7. if (strict === false) {
  8. return false;
  9. }
  10. if (strict === 'throw') {
  11. throw new StrictModeError(null,
  12. `Field ${fullPath} is immutable and strict = 'throw'`);
  13. }
  14. delete obj[key];
  15. return true;
  16. };