didyoumean2
didyoumean2 copied to clipboard
returns non similar value.
I am using this package for a discord bot, but I have an array of my command names and when I try to sort through the array with this package it doesn't return a similar value. here is a code example.
const didYouMean = require("didyoumean2").default;
let command_names = [ 'block',
'stats',
'config',
'disable',
'enable',
'prefix',
'user-config',
'help',
'invite',
'ping',
'server-perms',
'guild-info',
'info',
'role-info',
'notes',
'enable-devmode',
'guild-language',
'toggle-dnd',
'toggle-language-override',
'toggle-ocr',
'user-language',
'regexes',
'words' ];
const maybe = didYouMean('re', command_names, { // should find and return `regexes` since it is the closest value to `re` instead returns `help` because it comes before the value `regexes`
threshold: 5,
thresholdType: 'edit-distance',
returnType: 'all-closest-matches'
});
console.log(maybe);