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