2025-03-25 22:06:48 +01:00

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
},
}