I am working on a project where I need to covert a list of words into all possible options using symbols / numbers.
I actually want functionality pretty much identical to This Stack Overflow Question, however, it is written in Python using the intertools.product method. I do not know how to convert this into JS.
For example:
let givenInput= 'hello';
let expectedOutput = ["hello", "h3llo", "he1lo", "hel1o", "hell0", "h31lo", "h3l1o", "h3ll0", "he11o", "he1l0", "hel10", "h311o", "h31l0", "h3l10", "he110", "h3110"];
I tried having an object with the replacements I am expecting:
let REPLACE = {
'o': '0',
'e': '3',
'l': '1',
'a': '@'
}
I have tried a more manual method, where I replace one letter, add that option to an array, change another, add that to the array, etc. But I need to know too much about the string I am manipulating.
I have also tried to just use string.replace() using a regex, but that only really seems to work when I am replacing ALL of one character with another one and not one at a time.
The end goal of this is a generator to generate a list of words I do not want to be allowed in a name creator. So like, I want to exclude bad words, and all possible letter-replacement versions of those words.