Skip to content

limeandcoconut/alphastring

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

NPM

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.

About

A minimal alphabetical semi-unique id generator.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published