Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
27 lines
992 B
Plaintext
27 lines
992 B
Plaintext
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.isCompound = exports.isPrimitive = exports.isBoolean = exports.getRootSchema = exports.Intersection = exports.Types = exports.Parent = void 0;
|
|
const lodash_1 = require("lodash");
|
|
exports.Parent = Symbol('Parent');
|
|
exports.Types = Symbol('Types');
|
|
exports.Intersection = Symbol('Intersection');
|
|
exports.getRootSchema = (0, lodash_1.memoize)((schema) => {
|
|
const parent = schema[exports.Parent];
|
|
if (!parent) {
|
|
return schema;
|
|
}
|
|
return (0, exports.getRootSchema)(parent);
|
|
});
|
|
function isBoolean(schema) {
|
|
return schema === true || schema === false;
|
|
}
|
|
exports.isBoolean = isBoolean;
|
|
function isPrimitive(schema) {
|
|
return !(0, lodash_1.isPlainObject)(schema);
|
|
}
|
|
exports.isPrimitive = isPrimitive;
|
|
function isCompound(schema) {
|
|
return Array.isArray(schema.type) || 'anyOf' in schema || 'oneOf' in schema;
|
|
}
|
|
exports.isCompound = isCompound;
|
|
//# sourceMappingURL=JSONSchema.js.map |