@tsed/schema-formio
Version:
Transform Ts.ED Schema & JsonSchema to a valid Formio schema
15 lines (14 loc) • 486 B
JavaScript
const FormioMappersContainer = new Map();
export function registerFormioMapper(type, mapper) {
return FormioMappersContainer.set(type, mapper);
}
export function getFormioMapper(type) {
// istanbul ignore next
if (!FormioMappersContainer.has(type)) {
throw new Error(`Formio ${type} mapper doesn't exists`);
}
return FormioMappersContainer.get(type);
}
export function execMapper(type, schema, options) {
return getFormioMapper(type)(schema, options);
}