From cf455a103bb772fc44c949d773ac927721f3111b Mon Sep 17 00:00:00 2001 From: anekos Date: Fri, 10 Oct 2008 14:42:44 +0000 Subject: 変数をお漏らししないように、{} で囲った。 git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@21090 d0d07461-0603-4401-acd4-de1884942a52 --- plugin_loader.js | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) (limited to 'plugin_loader.js') diff --git a/plugin_loader.js b/plugin_loader.js index cc5190a..c9c36b0 100644 --- a/plugin_loader.js +++ b/plugin_loader.js @@ -17,27 +17,28 @@ // Link: // http://d.hatena.ne.jp/nokturnalmortum/20081008#1223397705 +{ + function toArray (obj) { + return obj instanceof Array ? obj + : obj.toString().split(/[,| \t\r\n]+/); + } -function toArray (obj) { - return obj instanceof Array ? obj - : obj.toString().split(/[,| \t\r\n]+/); -} - -let roots = toArray(globalVariables.plugin_loader_roots); -let plugins = toArray(globalVariables.plugin_loader_plugins); -let filter = new RegExp('[\\\\/](?:' + - plugins.map(function (plugin) plugin.replace(/(?=[\\^$.+*?|(){}\[\]])/g, '\\')) - .join('|') + - ')\\.(?:js|vimp)$'); + let roots = toArray(globalVariables.plugin_loader_roots); + let plugins = toArray(globalVariables.plugin_loader_plugins); + let filter = new RegExp('[\\\\/](?:' + + plugins.map(function (plugin) plugin.replace(/(?=[\\^$.+*?|(){}\[\]])/g, '\\')) + .join('|') + + ')\\.(?:js|vimp)$'); -log('plugin_loader: loading'); + log('plugin_loader: loading'); -roots.forEach(function (root) { - let files = io.readDirectory(io.getFile(root), true); - files.forEach(function (file) { - if (filter.test(file.path)) - liberator.io.source(file.path, false); + roots.forEach(function (root) { + let files = io.readDirectory(io.getFile(root), true); + files.forEach(function (file) { + if (filter.test(file.path)) + liberator.io.source(file.path, false); + }); }); -}); -log('plugin_loader: loaded'); + log('plugin_loader: loaded'); +} -- cgit v1.2.3