Wrap plugin function with pluginFactory