jonschlinkert / randomatic

Easily generate random strings like passwords, with simple options for specifying a length and for using patterns of numeric, alpha-numeric, alphabetical, special or custom characters. (the original "generate-password")
https://github.com/jonschlinkert
MIT License
183 stars 25 forks source link

New Feature For Skipping Specified Char #12

Closed nitishthakrarsa closed 6 years ago

nitishthakrarsa commented 6 years ago

Recently I was working on one project and I was asked to generate a random String with numeric and letter values with specified number like 0 and specified char O as my client was getting confused in between this two char.

So I am suggesting here to add one more argument to the function with array specified value like as below. [ '0', 'O', 'o'] so it will generate a random string without given values in array.

doowb commented 6 years ago

I think this is a good idea, but it should be an option on the options object instead of another argument to the function. Would you like to do a PR?

jonschlinkert commented 6 years ago

what if we just allow a function to be passed, so you can dynamically choose the character to use?

kivlor commented 6 years ago

I've opened a PR (#16) that adds exclude to the options that will take a string or an array. I wasn't sure the best approach to take to allow passing a function... Sorry @jonschlinkert