-
Notifications
You must be signed in to change notification settings - Fork 5
Description
I'm trying to use this package in a project, but I wanted to use lowercased letters instead, so I used the string "abcdefghijkmnpqrstuvwxyz23456789" instead (removing the characters "l10o"). I was using the isValid call to in a test to check that a field was being filled with a valid value, but apparently, isValid is resetting the characters to the original string and checking against that, failing the current isValid check and causing any further use of generate() to use the originally capitalized string.
Here is an example of what I'm seeing, starting node from the root of the project:
var shortid32 = require(".");
shortid32.characters("abcdefghijkmnpqrstuvwxyz23456789");
var id = shortid32.generate();
console.log(id); // Should return something like 'yhzz6ad9z'
var check = shortid32.isValid(id);
console.log(check); // Returns false!
console.log(shortid32.characters()); // Returns something like 'DPZNKTVGCAX9J5WUMFRYHE4LS236Q78B'!!
id = shortid32.generate();
console.log(id); // Returns something like 'VMRLUQ78K'!I'll just leave this validity check out in my tests and just do a basic "is string" check, but just wanted to put a heads up on this very unexpected behavior.