createComponent(name, component, metadata) {
    const implementation = component;
    if (!implementation) {
      return Promise.reject(new Error(`Component ${name} not available`));
    }

    // If a string was specified, attempt to `require` it.
    if (typeof implementation === 'string') {
      if (typeof registerLoader.dynamicLoad === 'function') {
        return new Promise((resolve, reject) => {
          registerLoader.dynamicLoad(name, implementation, metadata, (err, instance) => {
            if (err) {
              reject(err);
              return;
            }
            resolve(instance);
          });
        });
      }
      return Promise.reject(Error(`Dynamic loading of ${implementation} for component ${name} not available on this platform.`));
    }

    // Attempt to create the component instance using the `getComponent` method.
    let instance;
    const impl = /** @type ModuleComponent */ (implementation);
    if (typeof impl.getComponent === 'function') {
      try {
        instance = impl.getComponent(metadata);
      } catch (error) {
        return Promise.reject(error);
      }
      // Attempt to create a component using a factory function.
    } else if (typeof implementation === 'function') {
      try {
        instance = implementation(metadata);
      } catch (error) {
        return Promise.reject(error);
      }
    } else {
      return Promise.reject(new Error(`Invalid type ${typeof (implementation)} for component ${name}.`));
    }
    return Promise.resolve(instance);
  }
Creates an instance of a component.
@param {string} name
@param {ComponentDefinitionWithoutGraph} component
@param {import("fbp-graph/lib/Types").GraphNodeMetadata} metadata
@returns {Promise<import("./Component").Component>}