From: anthony Date: Fri, 15 Jun 2018 05:45:25 +0000 (-0400) Subject: fixing the functions that ensure that the lines of the files are valid X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=faebef3446c92a7f70b5e167478bce93416e0c20;p=WP-Themes%2FglmOrigin.git fixing the functions that ensure that the lines of the files are valid and that they match the modules properties --- diff --git a/setup/moduleLib.js b/setup/moduleLib.js index 3c267de..de66f48 100644 --- a/setup/moduleLib.js +++ b/setup/moduleLib.js @@ -14,24 +14,46 @@ const modLib = (function() { }); }, checkLine: function(line, mod){ - for (var i = 0; i < acceptedToken.length; i++) { - if (line.startsWith(acceptedToken[i]) && (line.indexOf(`${mod.name}"`) > -1 || line.indexOf(`${mod.name}.php`) > -1) ){ - console.log(line) - break; - } - } + if ( modLib.moduleFound(line, mod)){ + console.log(line) + } }, editFile: function(reader,mod){ reader.on("line",function(line){ modLib.checkLine(line, mod) }) }, - + moduleFound(line,mod){ + if(modLib.isValidLine(line, mod) ){ + if(line.indexOf(`${mod.name}"`) > -1 || line.indexOf(`${mod.name}.php`) > -1){ + return true; + } else { + return false; + } + } + }, + deactivateModule(mod, line){ + + }, + isValidLine(line){ + let valid = false; + for (var i = 0; i < acceptedToken.length; i++) { + if(line.startsWith(acceptedToken[i]) ){ + valid = true; + break; + } else{ + valid = false; + } + } + return valid; + }, setModules: function(modType,modName){ appState[modType] = modName; return appState; }, - + moduleActive(mod){ + return mod.active; + }, storeModules: function(appState){ localStorage.setItem("app", JSON.stringify(appState)); },