From 6e64708a376c6401e0ffac365e2bca0b42d1daee Mon Sep 17 00:00:00 2001 From: lub Date: Tue, 17 Oct 2017 10:00:52 +0200 Subject: [PATCH] add commands alias to module.exports --- commands.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/commands.js b/commands.js index 943eb1a..57d4fd7 100644 --- a/commands.js +++ b/commands.js @@ -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