1var meant = require('meant') 2 3function didYouMean (scmd, commands) { 4 var bestSimilarity = meant(scmd, commands).map(function (str) { 5 return ' ' + str 6 }) 7 8 if (bestSimilarity.length === 0) return '' 9 if (bestSimilarity.length === 1) { 10 return '\nDid you mean this?\n' + bestSimilarity[0] 11 } else { 12 return ['\nDid you mean one of these?'] 13 .concat(bestSimilarity.slice(0, 3)).join('\n') 14 } 15} 16 17module.exports = didYouMean 18