wavesurfer-react
Version:
react wrapper for wavesurfer.js
13 lines • 598 B
JavaScript
export default function createPlugin(pluginObj) {
const { plugin, options, creator = 'create' } = pluginObj;
const createMethod = plugin[creator];
if (!plugin)
throw new Error(`Please pass a valid plugin in plugin list`);
if (!creator)
throw new Error(`Please pass the creator function name in 'creator' property.`);
if (typeof createMethod !== 'function') {
throw new Error(`"${creator}" is not callable on given plugin. Please pass a valid 'creator' in plugins list.`);
}
return createMethod(options);
}
//# sourceMappingURL=createPlugin.js.map