summaryrefslogtreecommitdiffstats
path: root/lib/modifiers/config/removePlugin.js
blob: ead22ea2b7a147ea2424fc4b9c75f2e2d9482558 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

/**
 * Remove a plugin from a book's configuration
 * @param {Book} book
 * @param {String} plugin
 * @return {Book}
 */
function removePlugin(book, pluginName) {
    var config = book.getConfig();
    var deps = config.getPluginDependencies();


    deps = deps.filter(function(dep) {
        return dep.getName() === pluginName;
    });
    config = config.setPluginDependencies(deps);

    return book.setConfig(config);
}

module.exports = removePlugin;