satinizePlugin = (plugin, eventsHandler) => {
  let pluginRes = null;

  if (typeof plugin === 'function') {
    pluginRes = Object.assign({}, DEFAULT_CONFIG_PROPS, {
      name: null,
      __invoked: true,
      __func: plugin
    });

    eventsHandler.dispatch('warn', {
      msg:
        'It is not recommended to use a function as a lepto plugins,'
        + ' functions cannot be overriden by another filter'
        + ', see https://github.com/leptojs/lepto#plugins',
      callOnceId: 'plugin-as-a-function'
    });
  } else if (typeof plugin === 'string') {
    pluginRes = Object.assign({}, DEFAULT_CONFIG_PROPS, {
      name: plugin,
      __func: resolverPlugin(plugin, eventsHandler)
    });
  } else if (typeof plugin.name === 'string') {
    pluginRes = Object.assign({}, DEFAULT_CONFIG_PROPS, plugin, {
      __func: resolverPlugin(plugin.name, eventsHandler)
    });
  } else {
    eventsHandler.dispatch(
      'error',
      `Invalid plugin format: ${String(plugin)}`
        + ', see https://github.com/leptojs/lepto#plugins'
    );
  }

  if (pluginRes && !pluginRes.disabled) {
    if (!pluginRes.__invoked) {
      if (typeof pluginRes.__func !== 'function') {
        pluginRes.__func = (input, fulfill) => {
          fulfill(input);
        };
      } else {
        Object.assign(pluginRes, {
          __func: pluginRes.__func(pluginRes)
        });
      }
    }
    return pluginRes;
  }

  return null;
}
Satinize and resolve a plugin
@param {objecy} plugin
@param {EventsHandler} eventsHandler