function registerModule(mod, defaultFn = null, options = {}) {
  if (typeof mod === 'function') {
    return registerModule(mod(Formio), defaultFn, options);
  }
  if (typeof mod !== 'object') {
    return;
  }
  for (const key of Object.keys(mod)) {
    const current = mod.framework || Formio.Templates.framework || 'bootstrap';
    switch (key) {
      case 'options':
        Formio.options = _.merge(Formio.options, mod.options);
        break;
      case 'templates':
        for (const framework of Object.keys(mod.templates)) {
          Formio.Templates.extendTemplate(framework, mod.templates[framework]);
          Formio.Templates.defaultTemplates = _.defaults(
            mod.templates[framework],
            Formio.Templates.defaultTemplates
          );
        }
        if (mod.templates[current]) {
          Formio.Templates.current = mod.templates[current];
        }
        break;
      case 'components':
        Formio.Components.setComponents(mod.components);
        break;
      case 'framework':
        Formio.Templates.framework = mod.framework;
        break;
      case 'fetch':
        for (const name of Object.keys(mod.fetch)) {
          Formio.registerPlugin(mod.fetch[name], name);
        }
        break;
      case 'providers':
        for (const type of Object.keys(mod.providers)) {
          Formio.Providers.addProviders(type, mod.providers[type]);
        }
        break;
      case 'displays':
        Formio.Displays.addDisplays(mod.displays);
        break;
      case 'evaluator':
        registerEvaluator(mod.evaluator);
        break;
      case 'translations':
        I18n.setDefaultTranslations(mod.translations);
        break;
      case 'library':
        options.license
          ? Formio.Licenses.addLicense(mod.library, options.license)
          : Formio.Licenses.removeLicense(mod.library);
        break;
      default:
        if (defaultFn) {
          if (!defaultFn(key, mod)) {
            console.warn('Unknown module option', key);
          }
          break;
        }
        console.log('Unknown module option', key);
    }
  }
}
Register a module
@param {any} mod - The module object to register. This can also be a function which accepts Formio as an argument.
@param {Function|null} [defaultFn] - The default function to call if the module does not have a known key.
@param {any} options - Options for the module.
@returns {void}