路泰科技体检小程序UI设计新版本
1
wwl
2025-07-30 61b58bd03d04d2eb50ac2d93a188c819fe67e01e
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
"use strict";
 
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
 
/** @typedef {import("ajv").Ajv} Ajv */
 
/**
 *
 * @param {Ajv} ajv
 * @param {string} keyword
 * @param {any} definition
 */
function addKeyword(ajv, keyword, definition) {
  let customRuleCode;
 
  try {
    // @ts-ignore
    // eslint-disable-next-line global-require
    customRuleCode = require("ajv/lib/dotjs/custom"); // @ts-ignore
 
    const {
      RULES
    } = ajv;
    let ruleGroup;
 
    for (let i = 0; i < RULES.length; i++) {
      const rg = RULES[i];
 
      if (typeof rg.type === "undefined") {
        ruleGroup = rg;
        break;
      }
    }
 
    const rule = {
      keyword,
      definition,
      custom: true,
      code: customRuleCode,
      implements: definition.implements
    };
    ruleGroup.rules.unshift(rule);
    RULES.custom[keyword] = rule;
    RULES.keywords[keyword] = true;
    RULES.all[keyword] = true;
  } catch (e) {// Nothing, fallback
  }
}
/**
 *
 * @param {Ajv} ajv
 * @returns {Ajv}
 */
 
 
function addUndefinedAsNullKeyword(ajv) {
  // There is workaround for old versions of ajv, where `before` is not implemented
  addKeyword(ajv, "undefinedAsNull", {
    modifying: true,
 
    /**
     * @param {boolean} kwVal
     * @param {unknown} data
     * @param {any} parentSchema
     * @param {string} dataPath
     * @param {unknown} parentData
     * @param {number | string} parentDataProperty
     * @return {boolean}
     */
    validate(kwVal, data, parentSchema, dataPath, parentData, parentDataProperty) {
      if (kwVal && parentSchema && typeof parentSchema.enum !== "undefined" && parentData && typeof parentDataProperty === "number") {
        const idx =
        /** @type {number} */
        parentDataProperty;
        const parentDataRef =
        /** @type {any[]} */
        parentData;
 
        if (typeof parentDataRef[idx] === "undefined") {
          parentDataRef[idx] = null;
        }
      }
 
      return true;
    }
 
  });
  return ajv;
}
 
var _default = addUndefinedAsNullKeyword;
exports.default = _default;