Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
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.

validate.js 842B

1234567891011121314151617181920212223242526272829303132
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = validate;
  6. exports.validateField = validateField;
  7. exports.validateChild = validateChild;
  8. var _definitions = require("../definitions");
  9. function validate(node, key, val) {
  10. if (!node) return;
  11. const fields = _definitions.NODE_FIELDS[node.type];
  12. if (!fields) return;
  13. const field = fields[key];
  14. validateField(node, key, val, field);
  15. validateChild(node, key, val);
  16. }
  17. function validateField(node, key, val, field) {
  18. if (!(field != null && field.validate)) return;
  19. if (field.optional && val == null) return;
  20. field.validate(node, key, val);
  21. }
  22. function validateChild(node, key, val) {
  23. if (val == null) return;
  24. const validate = _definitions.NODE_PARENT_VALIDATIONS[val.type];
  25. if (!validate) return;
  26. validate(node, key, val);
  27. }