2019-12-20 10:53:27 -05:00
|
|
|
function createPlugin(plugin, config) {
|
|
|
|
|
return {
|
|
|
|
|
handler: plugin,
|
|
|
|
|
config,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
createPlugin.withOptions = function(pluginFunction, configFunction) {
|
|
|
|
|
const optionsFunction = function(options) {
|
|
|
|
|
return {
|
|
|
|
|
handler: pluginFunction(options),
|
2020-01-03 12:36:33 -05:00
|
|
|
config: configFunction ? configFunction(options) : {},
|
2019-12-20 10:53:27 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
optionsFunction.__isOptionsFunction = true
|
|
|
|
|
|
|
|
|
|
return optionsFunction
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default createPlugin
|