random-char
Return a random character.
Install
$ npm install --save random-char
Usage
For more use-cases see the tests
var randomChar = require('random-char');
randomChar();
By default it will return a string with random character from the following pool:
'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789~!@#$%^&()*_+-={}[]'
Optionally specify a pool:
randomChar('alpha');
randomChar({alpha: true});
randomChar('upper');
randomChar({upper: true});
randomChar('lower');
randomChar({lower: true});
randomChar('number');
randomChar({number: true});
randomChar('symbols');
randomChar({symbols: true});
Optionally specify a pool and the character will be generated with characters only from that pool:
randomChar('abcde');
randomChar({pool: 'abcde'});
Related
Contributing
Pull requests and stars are highly welcome.
For bugs and feature requests, please create an issue.