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

/**
    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;