wavesurfer-react
Version:
react wrapper for wavesurfer.js
17 lines (13 loc) • 639 B
JavaScript
;
Object.defineProperty(exports, '__esModule', { value: true });
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);
}
exports.default = createPlugin;