@inkline/inkline
Version:
Inkline is the intuitive UI Components library that gives you a developer-friendly foundation for building high-quality, accessible, and customizable Vue.js 3 Design Systems.
25 lines (24 loc) • 766 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.setSchemaStateRecursively = setSchemaStateRecursively;
var _constants = require("@inkline/inkline/constants");
function setSchemaStateRecursively(schema, values) {
const resolvedSchema = {
...schema
};
Object.keys(values).forEach(key => {
const value = values[key];
if (!Array.isArray(schema)) {
resolvedSchema[key] = value;
}
});
Object.keys(schema).filter(key => !_constants.reservedValidationFields.includes(key)).forEach(key => {
const field = schema[key];
if (typeof schema[key] === "object" || Array.isArray(schema[key])) {
resolvedSchema[key] = setSchemaStateRecursively(field, values);
}
});
return resolvedSchema;
}