UNPKG

730 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.isCompound = exports.isPrimitive = exports.getRootSchema = exports.Parent = void 0;
4var lodash_1 = require("lodash");
5exports.Parent = Symbol('Parent');
6exports.getRootSchema = lodash_1.memoize(function (schema) {
7 var parent = schema[exports.Parent];
8 if (!parent) {
9 return schema;
10 }
11 return exports.getRootSchema(parent);
12});
13function isPrimitive(schema) {
14 return !lodash_1.isPlainObject(schema);
15}
16exports.isPrimitive = isPrimitive;
17function isCompound(schema) {
18 return Array.isArray(schema.type) || 'anyOf' in schema || 'oneOf' in schema;
19}
20exports.isCompound = isCompound;
21//# sourceMappingURL=JSONSchema.js.map
\No newline at end of file