jonschlinkert/randomatic

Exclude not working.

kross50 opened this issue · 3 comments

Hi, love what you've done. Found a little issue in 3.1.0

Exclude defined:
password = randomize('*', 10, { exclude: '0oOiIlL1$^()_{}[];',.' });

Output:
joPUbWOU21

Observations:
Exclude not working as we can see that o and O that were specified to be excluded are being used. Also, in other tests of mine, I see (){} being used output as well.

My Temp Workaround:
password = randomize('?', 10, {chars: 'abcdefghjkmnopqrstuvwxyzABCDEFGHJKMNPQRSTUVWXYZ123456789~!@#&+-='});

doowb commented

Thanks for the issue. This does look like a bug and I think it's because the regex used to remove the characters is built by doing a naive string concatenation. If you or someone else has an idea on a fix, please feel free to submit a PR. If not, I'll try to get a fix done by this weekend.

I would like to work on this!

doowb commented

Fixed in #19