source: trip-planner-front/node_modules/@babel/plugin-transform-object-super/node_modules/@babel/types/lib/validators/validate.js@ e29cc2e

Last change on this file since e29cc2e was e29cc2e, checked in by Ema <ema_spirova@…>, 3 years ago

primeNG components

  • Property mode set to 100644
File size: 842 bytes
Line 
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.default = validate;
7exports.validateChild = validateChild;
8exports.validateField = validateField;
9
10var _definitions = require("../definitions");
11
12function validate(node, key, val) {
13 if (!node) return;
14 const fields = _definitions.NODE_FIELDS[node.type];
15 if (!fields) return;
16 const field = fields[key];
17 validateField(node, key, val, field);
18 validateChild(node, key, val);
19}
20
21function validateField(node, key, val, field) {
22 if (!(field != null && field.validate)) return;
23 if (field.optional && val == null) return;
24 field.validate(node, key, val);
25}
26
27function validateChild(node, key, val) {
28 if (val == null) return;
29 const validate = _definitions.NODE_PARENT_VALIDATIONS[val.type];
30 if (!validate) return;
31 validate(node, key, val);
32}
Note: See TracBrowser for help on using the repository browser.