mirror of
https://github.com/astefanutti/decktape.git
synced 2024-12-13 10:20:46 +03:00
Plugins loading function uses reduce instead of forEach
This commit is contained in:
parent
3f06784c5f
commit
513cf2c8e2
15
decktape.js
15
decktape.js
@ -112,15 +112,12 @@ page.open(options.url, function(status) {
|
||||
});
|
||||
|
||||
function loadAvailablePlugins() {
|
||||
var plugins = {};
|
||||
fs.list("plugins/").forEach(function(script) {
|
||||
if (fs.isFile("plugins/" + script)) {
|
||||
var matches = script.match(/^(.*)\.js$/);
|
||||
if (matches)
|
||||
plugins[matches[1]] = require("./plugins/" + matches[1]);
|
||||
}
|
||||
});
|
||||
return plugins;
|
||||
return fs.list("plugins/").reduce(function(plugins, plugin) {
|
||||
var matches = plugin.match(/^(.*)\.js$/);
|
||||
if (matches && fs.isFile("plugins/" + plugin))
|
||||
plugins[matches[1]] = require("./plugins/" + matches[1]);
|
||||
return plugins;
|
||||
}, {});
|
||||
}
|
||||
|
||||
function createActivePlugin() {
|
||||
|
Loading…
Reference in New Issue
Block a user