alphastring
v1.0.2
Published
A minimal alphabetical semi-unique id generator.
Downloads
12
Maintainers
Readme
alphastring
A minimal alphabetical semi-unique id generator. Best for random string generation in scenarios where strict uniqueness is not imperative.
This package should be used in non critical code, it is for convenience.
Not cryptographically sound! Not unique, only pseudo random!
let auid = require('alphastring');
console.log(auid()); // kfbxtyurktqm
console.log(auid(6)); // hkqqlw
console.log(auid(40)); // tmqxwarcpfxnffzgacgehbgvaemfsnviwpffldkx
function createClass() {
let componentName = alphastring();
let propertyName = alphastring();
let functionString = `return function ${componentName}(){this.${propertyName} = 'foo'; this.propertyName = '${propertyName}';}`;
return Function(functionString)();
}
Usage
default alphastring();
Returns an alphabetical string of 12 characters.
length alphastring(length);
Returns an alphabetical string of desired length.
License
MIT, see LICENSE.md for details.