12 lines
344 B
JavaScript
12 lines
344 B
JavaScript
export const plugin = {
|
|
withOptions: (pluginFunction, configFunction = () => ({})) => {
|
|
const optionsFunction = (options) => {
|
|
const handler = pluginFunction(options)
|
|
const config = configFunction(options)
|
|
return { handler, config }
|
|
}
|
|
optionsFunction.__isOptionsFunction = true
|
|
return optionsFunction
|
|
},
|
|
}
|