Files
NapCatQQ/.pnpm-store/v3/files/02/48d539e590234ac424385cb7b0093f877c812e30f276d31b08056c1e093ac223bcacefb23378f68456c2ab23c11519a221fdb6ffdcfcbf38d2a7e3f8cd0eda
T
TanTan e311ca3275
Build NapCat Artifacts / Type Check & Test (push) Waiting to run
docs: 仓库链接指向本镜像仓库
2026-11-13 09:25:58 +08:00

21 lines
770 B
Plaintext

import { Kind } from '../symbols/index.mjs';
/** Fast undefined check used for properties of type undefined */
function Intersect(schema) {
return schema.allOf.every((schema) => ExtendsUndefinedCheck(schema));
}
function Union(schema) {
return schema.anyOf.some((schema) => ExtendsUndefinedCheck(schema));
}
function Not(schema) {
return !ExtendsUndefinedCheck(schema.not);
}
/** Fast undefined check used for properties of type undefined */
// prettier-ignore
export function ExtendsUndefinedCheck(schema) {
return (schema[Kind] === 'Intersect' ? Intersect(schema) :
schema[Kind] === 'Union' ? Union(schema) :
schema[Kind] === 'Not' ? Not(schema) :
schema[Kind] === 'Undefined' ? true :
false);
}