add commands alias to module.exports

master
lub 7 years ago
parent 4251245218
commit 6e64708a37

@ -1,5 +1,7 @@
const fs = require('fs');
const commands = module.exports = {};
// Compute the edit distance between the two given strings
function getEditDistance(sourceString, targetString) {
if (sourceString.length === 0) return targetString.length;
@ -53,8 +55,8 @@ function fetchCommand(input, commands, threshhold){
return candidates;
}
module.exports.fetchCommand = fetchCommand;
module.exports.getEditDistance = getEditDistance;
commands.fetchCommand = fetchCommand;
commands.getEditDistance = getEditDistance;
fs.readdirSync('./projects').forEach((file) => {
let project = file.match(/^([a-z]*)\.js$/);
@ -64,7 +66,7 @@ fs.readdirSync('./projects').forEach((file) => {
}
project = project[1];
module.exports[project] = require('./projects/' + file);
commands[project] = require('./projects/' + file);
});
/* //Test code